public function BootstrapLayoutsBase::getConfiguration in Bootstrap Layouts 8.4
Gets this plugin's configuration.
Return value
array An array of this plugin's configuration.
Overrides LayoutBase::getConfiguration
1 call to BootstrapLayoutsBase::getConfiguration()
- BootstrapLayoutsBase::buildConfigurationForm in src/
Plugin/ Layout/ BootstrapLayoutsBase.php - Form constructor.
File
- src/
Plugin/ Layout/ BootstrapLayoutsBase.php, line 67
Class
- BootstrapLayoutsBase
- Layout class for all bootstrap layouts.
Namespace
Drupal\bootstrap_layouts\Plugin\LayoutCode
public function getConfiguration() {
$configuration = $this
->defaultConfiguration();
// Can't use parent::getConfiguration() here because array_merge() only
// merges the top levels. Nor can NestedArray::mergeDeep be used since it
// will add multiple classes (from default + config). Instead, the two
// top levels "layout" and "regions" must be merged using array_merge().
if (isset($this->configuration['layout'])) {
$configuration['layout'] = array_merge($configuration['layout'], $this->configuration['layout']);
}
if (isset($this->configuration['regions'])) {
$configuration['regions'] = array_merge($configuration['regions'], $this->configuration['regions']);
}
// Remove any region configuration that doesn't apply to current layout.
$regions = $this
->getRegionNames();
foreach (array_keys($configuration['regions']) as $region) {
if (!isset($regions[$region])) {
unset($configuration['regions'][$region]);
}
}
return $configuration;
}