public function BootstrapLayout::getStyleOptions in Bootstrap Layout Builder 1.x
Same name and namespace in other branches
- 2.x src/Plugin/Layout/BootstrapLayout.php \Drupal\bootstrap_layout_builder\Plugin\Layout\BootstrapLayout::getStyleOptions()
Helper function to get the options of given style name.
Parameters
string $name: A config style name like background_color.
Return value
array Array of key => value of style name options.
1 call to BootstrapLayout::getStyleOptions()
- BootstrapLayout::buildConfigurationForm in src/
Plugin/ Layout/ BootstrapLayout.php - Form constructor.
File
- src/
Plugin/ Layout/ BootstrapLayout.php, line 242
Class
- BootstrapLayout
- A layout from our bootstrap layout builder.
Namespace
Drupal\bootstrap_layout_builder\Plugin\LayoutCode
public function getStyleOptions(string $name) {
$config = $this->configFactory
->get('bootstrap_layout_builder.settings');
$options = [];
$config_options = $config
->get($name);
$options = [
'_none' => t('N/A'),
];
$lines = explode(PHP_EOL, $config_options);
foreach ($lines as $line) {
$line = explode('|', $line);
if ($line && isset($line[0]) && isset($line[1])) {
$options[$line[0]] = $line[1];
}
}
return $options;
}