You are here

function ultimenu_regions_enabled in Ultimenu 7

Returns the array of enabled Ultimenu regions based on enabled settings.

2 calls to ultimenu_regions_enabled()
ultimenu_admin_settings in includes/ultimenu.admin.inc
Menu callback for 'admin/structure/ultimenu'.
ultimenu_system_info_alter in ./ultimenu.module
Implements hook_system_info_alter().
1 string reference to 'ultimenu_regions_enabled'
ultimenu_admin_settings_form_submit in includes/ultimenu.admin.inc
Submit handler for ultimenu_admin_settings().

File

includes/ultimenu.utilities.inc, line 73
Misc functions that hardly change.

Code

function ultimenu_regions_enabled($delta = NULL) {
  $regions =& drupal_static(__FUNCTION__);
  if (!isset($regions)) {
    $regions = array();
    $regions_all = ultimenu_regions($delta);

    // First limit to enabled regions from the settings.
    if (($regions_enabled = ultimenu_get_settings('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)) {
          $regions[$enabled] = $regions_all[$enabled];
        }
      }
    }
  }
  return $regions;
}