function hosting_package_menu in Hosting 5
File
- package/
hosting_package.module, line 29
Code
function hosting_package_menu($may_cache) {
$items = array();
if (!$may_cache) {
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if (in_array($node->type, array(
'site',
'platform',
'package',
))) {
$items[] = array(
'path' => 'node/' . arg(1) . '/packages',
'title' => t('Packages'),
'description' => t('List of packages available for this platform'),
'callback' => 'hosting_package_list',
'callback arguments' => array(
arg(1),
),
'type' => MENU_LOCAL_TASK,
'access' => user_access('view package'),
'weight' => 1,
);
$items[] = array(
'path' => 'node/' . arg(1) . '/packages/all',
'title' => t('All packages'),
'description' => t('List of all packages'),
'callback' => 'hosting_package_list',
'callback arguments' => array(
arg(1),
),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
);
foreach (_hosting_package_types() as $type => $description) {
$items[] = array(
'path' => 'node/' . arg(1) . '/packages/' . $type,
'title' => $description,
'description' => $description,
'callback' => 'hosting_package_list',
'callback arguments' => array(
arg(1),
$type,
),
'type' => MENU_LOCAL_TASK,
'weight' => $x++,
);
}
}
}
}
return $items;
}