Created
October 12, 2018 15:04
-
-
Save calvez/d528985066de18c782b3e0caf9a26dfc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If the paragraph type has got a background color field. | |
if (isset($element['subform']['bp_background']) && isset($element['subform']['bp_background']['widget'])) { | |
$configFactory = \Drupal::configFactory()->getEditable('varbase_bootstrap_paragraphs.settings'); | |
$background_colors = $configFactory->get('background_colors'); | |
$background_colors_options = ['_none' => t('N/A')]; | |
$lines = explode(PHP_EOL, $background_colors); | |
foreach($lines as $line) { | |
$line = explode('|', $line); | |
$background_colors_options[$line[0]] = $line[1]; | |
} | |
// Updated the bp_background options with the list of vbp colors. | |
$element['subform']['bp_background']['widget']['#options'] = $background_colors_options; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment