function ack_menu_realm_menus in Access Control Kit 7
Returns a list of menus that contain links for a realm.
Parameters
object $scheme: An access scheme.
int $realm: A realm value.
bool $reset: (optional) Whether to reset the internal cache. Defaults to FALSE.
Return value
array() An array of menu names.
1 call to ack_menu_realm_menus()
- ack_menu_form_node_form_alter in ack_menu/
ack_menu.module - Implements hook_form_BASE_FORM_ID_alter().
File
- ack_menu/
ack_menu.module, line 521 - The ACK menu module.
Code
function ack_menu_realm_menus($scheme, $realm, $reset = FALSE) {
$menus =& drupal_static(__FUNCTION__, array());
if (!isset($menus[$scheme->sid][$realm]) || $reset) {
$realm_menus = array();
if (isset($scheme->handlers['menu_link'])) {
// If we're resetting the cache, clear the realm links cache once here, so
// we don't do it repeatedly in the foreach statement below.
if ($reset) {
ack_menu_realm_links($scheme, $realm, NULL, TRUE);
}
// Find all managed menus that contain links.
$managed = $scheme->handlers['menu_link']
->managedMenus();
foreach (array_keys($managed) as $menu_name) {
$menu_links = ack_menu_realm_links($scheme, $realm, $menu_name);
if (!empty($menu_links)) {
$realm_menus[] = $menu_name;
}
}
}
$menus[$scheme->sid][$realm] = $realm_menus;
}
return $menus[$scheme->sid][$realm];
}