public function UltimenuManager::getEnabledRegions in Ultimenu 8
Same name and namespace in other branches
- 8.2 src/UltimenuManager.php \Drupal\ultimenu\UltimenuManager::getEnabledRegions()
Returns the array of enabled Ultimenu regions based on enabled settings.
Return value
array An array of enabled regions definition based on enabled menu items.
Overrides UltimenuManagerInterface::getEnabledRegions
File
- src/
UltimenuManager.php, line 480
Class
- UltimenuManager
- Manages Ultimenu plugin.
Namespace
Drupal\ultimenuCode
public function getEnabledRegions() {
if (!isset($this->enabledRegions)) {
$this->enabledRegions = [];
$regions_all = $this
->getRegions();
// First limit to enabled regions from the settings.
if (($regions_enabled = $this
->getSetting('regions')) !== NULL) {
foreach (array_filter($regions_enabled) as $enabled) {
// We must depends on enabled menu items as always.
// A disabled menu item will automatically drop its Ultimenu region.
if (array_key_exists($enabled, $regions_all)) {
$this->enabledRegions[$enabled] = $regions_all[$enabled];
}
}
}
}
return $this->enabledRegions;
}