domain_nav_menu($may_cache)
domain_nav/domain_nav.module, line 25
Implements hook_menu()
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' => $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;
}