You are here

function ultimenu_system_info_alter in Ultimenu 8.2

Same name and namespace in other branches
  1. 8 ultimenu.module \ultimenu_system_info_alter()
  2. 7 ultimenu.module \ultimenu_system_info_alter()

Implements hook_system_info_alter().

File

./ultimenu.module, line 67
Build Ultimenu blocks based on menu, and their regions on enabled menu items.

Code

function ultimenu_system_info_alter(&$info, Extension $file, $type) {
  if ($type == 'theme' && $file
    ->getName() == ultimenu()
    ->getThemeDefault() && 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]);
        }
      }
    }
  }
}