function domain_nav_menu in Domain Access 5
Same name and namespace in other branches
- 6.2 domain_nav/domain_nav.module \domain_nav_menu()
- 7.3 domain_nav/domain_nav.module \domain_nav_menu()
- 7.2 domain_nav/domain_nav.module \domain_nav_menu()
Implement hook_menu()
File
- domain_nav/
domain_nav.module, line 25 - Navigation block and menu options for Domain Access
Code
function domain_nav_menu($may_cache) {
global $base_url;
$items = array();
if ($may_cache && DOMAIN_NAV_MENU) {
$root = domain_default();
$items[] = array(
'path' => 'domain',
'title' => t('Domain'),
'description' => t('Go to main site'),
'callback' => 'drupal_goto',
'callback arguments' => array(
$root['path'],
),
'type' => MENU_SUGGESTED_ITEM,
'access' => TRUE,
);
// Generate the list of active domains as menu items
$domains = domain_domains();
foreach ($domains as $domain) {
// If the domain is not valid, we disable it by default.
$type = MENU_NORMAL_ITEM;
if (!$domain['valid']) {
$type = MENU_SUGGESTED_ITEM;
}
$items[] = array(
'path' => 'domain/' . $domain['subdomain'],
// Can't use absolute paths, so we goto.
'title' => check_plain($domain['sitename']),
'description' => t('Go to !domain', array(
'!domain' => $domain['subdomain'],
)),
'callback' => 'drupal_goto',
'callback arguments' => array(
$domain['path'],
),
'type' => $type,
'access' => TRUE,
);
}
}
// In the Garland header, we have to force the block to appear correctly.
drupal_add_css(drupal_get_path('module', 'domain_nav') . '/domain_nav.css');
return $items;
}