function ultimenu_system_info_alter in Ultimenu 8
Same name and namespace in other branches
- 8.2 ultimenu.module \ultimenu_system_info_alter()
- 7 ultimenu.module \ultimenu_system_info_alter()
Implements hook_system_info_alter().
File
- ./
ultimenu.module, line 50 - Build Ultimenu blocks based on menu, and their regions on enabled menu items.
Code
function ultimenu_system_info_alter(&$info, Extension $file, $type) {
$ultimenu = \Drupal::service('ultimenu.manager');
$theme_default = $ultimenu
->getConfig('system.theme')
->get('default');
if ($type == 'theme' && $file
->getName() == $theme_default && isset($info['regions'])) {
if ($regions = $ultimenu
->getEnabledRegions()) {
// Append the Ultimenu regions into the theme defined regions.
foreach ($regions as $key => $region) {
$info['regions'] += [
$key => $region,
];
}
// Remove unwanted Ultimenu regions from theme .info if so configured.
if (($remove_regions = $ultimenu
->removeRegions()) !== FALSE) {
foreach ($remove_regions as $key => $region) {
unset($info['regions'][$key]);
}
}
}
}
}