function domain_menu in Domain Access 5
Same name and namespace in other branches
- 6.2 domain.module \domain_menu()
- 7.3 domain.module \domain_menu()
- 7.2 domain.module \domain_menu()
Implement hook_menu()
File
- ./
domain.module, line 88 - Core module functions for the Domain Access suite.
Code
function domain_menu($may_cache) {
$items = array();
$admin = user_access('administer domains');
if ($may_cache) {
$items[] = array(
'title' => t('Domains'),
'path' => 'admin/build/domain',
'access' => $admin,
'callback' => 'domain_admin',
'callback arguments' => array(
'view',
),
'description' => t('Settings for the Domain Access module.'),
);
$items[] = array(
'title' => t('Domain list'),
'path' => 'admin/build/domain/view',
'access' => $admin,
'type' => MENU_DEFAULT_LOCAL_TASK,
'callback' => 'domain_admin',
'callback arguments' => array(
'view',
),
'weight' => -10,
);
$items[] = array(
'title' => t('Settings'),
'path' => 'admin/build/domain/settings',
'access' => $admin,
'type' => MENU_LOCAL_TASK,
'callback' => 'domain_admin',
'callback arguments' => array(
'configure',
),
'weight' => -8,
);
$items[] = array(
'title' => t('Create domain record'),
'path' => 'admin/build/domain/create',
'access' => $admin,
'type' => MENU_LOCAL_TASK,
'callback' => 'domain_admin',
'callback arguments' => array(
'create',
),
'weight' => -4,
);
$items[] = array(
'title' => t('Node settings'),
'path' => 'admin/build/domain/advanced',
'access' => $admin,
'type' => MENU_LOCAL_TASK,
'callback' => 'domain_admin',
'callback arguments' => array(
'advanced',
),
'weight' => -2,
);
// Register the batch actions as menu callbacks
$batch = module_invoke_all('domainbatch');
if (!empty($batch)) {
$items[] = array(
'title' => t('Batch updating'),
'path' => 'admin/build/domain/batch',
'access' => $admin,
'type' => MENU_LOCAL_TASK,
'callback' => 'domain_admin',
'callback arguments' => array(
'batch',
),
'weight' => 0,
);
// Get the submenu items
foreach ($batch as $key => $value) {
$items[] = array(
'title' => $value['#form']['#title'],
'path' => 'admin/build/domain/batch/' . $key,
'access' => isset($value['#permission']) ? user_access($value['#permission']) : $admin,
'type' => MENU_CALLBACK,
'callback' => 'domain_admin',
'callback arguments' => array(
'batch',
$key,
),
'weight' => $value['#weight'],
);
}
}
}
else {
$items[] = array(
'title' => t('Edit domain record'),
'path' => 'admin/build/domain/edit',
'access' => $admin,
'type' => MENU_CALLBACK,
'callback' => 'domain_admin',
'callback arguments' => array(
'edit',
arg(4),
),
);
$items[] = array(
'title' => t('Delete domain record'),
'path' => 'admin/build/domain/delete',
'access' => $admin,
'type' => MENU_CALLBACK,
'callback' => 'domain_admin',
'callback arguments' => array(
'delete',
arg(4),
),
);
// Make sure that our default grant is set at all times.
if (arg(0) == 'admin') {
domain_set_default_grant();
}
}
return $items;
}