function homebox_menu in Homebox 6.2
Same name and namespace in other branches
- 6.3 homebox.module \homebox_menu()
- 6 homebox.module \homebox_menu()
- 7.3 homebox.module \homebox_menu()
- 7.2 homebox.module \homebox_menu()
Implementation of hook_menu().
File
- ./
homebox.module, line 26 - Homebox main file, takes care of global functions settings constants, etc.
Code
function homebox_menu() {
$items = array();
// Created Homebox pages
$pages = homebox_pages();
if (is_array($pages) && count($pages) > 0) {
foreach ($pages as $page) {
$items[$page->settings['path']] = array(
'title' => $page->settings['title'],
'page callback' => 'homebox_build',
'page arguments' => array(
$page,
),
'access callback' => '_homebox_user_access_view_homebox',
'access arguments' => array(
$page,
),
'type' => $page->settings['menu'] ? MENU_NORMAL_ITEM : MENU_CALLBACK,
);
$items[$page->settings['path'] . '/block/%'] = array(
'title' => $page->settings['title'],
'page callback' => 'homebox_build_block',
'page arguments' => array(
$page,
count(explode('/', $page->settings['path'])) + 1,
),
'access callback' => '_homebox_user_access_view_homebox',
'access arguments' => array(
$page,
),
'type' => $page->settings['menu'] ? MENU_NORMAL_ITEM : MENU_CALLBACK,
);
}
}
// Optionally add a tab to user profiles
if ($name = variable_get('homebox_user_tab', '')) {
$page = homebox_get_page($name);
if ($page) {
$items['user/%user/' . $page->settings['path']] = array(
'title' => $page->settings['title'],
'page callback' => 'homebox_pre_build_user',
'page arguments' => array(
$page,
1,
),
'access callback' => '_homebox_user_access_view_user_homebox',
'access arguments' => array(
$page,
1,
),
'weight' => 1,
'type' => MENU_LOCAL_TASK,
);
$items['user/%user/' . $page->settings['path'] . '/block/%'] = array(
'page callback' => 'homebox_build_block',
'page arguments' => array(
$page,
4,
),
'access callback' => '_homebox_user_access_view_user_homebox',
'access arguments' => array(
$page,
1,
),
'type' => MENU_CALLBACK,
);
}
}
// Ajax Callbacks
$items['homebox/%homebox/restore'] = array(
'title' => t('Restore'),
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_restore_defaults',
1,
),
'access callback' => '_homebox_user_access_view_homebox',
'access arguments' => array(
1,
TRUE,
),
'type' => MENU_CALLBACK,
);
$items['homebox/js/%homebox/add/%/%'] = array(
'page callback' => 'homebox_add_block',
'page arguments' => array(
2,
4,
5,
),
'access callback' => 'homebox_edit_access',
'access arguments' => array(
2,
),
'type' => MENU_CALLBACK,
);
$items['homebox/js/%homebox/save'] = array(
'page callback' => 'homebox_js_save_user_settings',
'page arguments' => array(
2,
),
'access callback' => '_homebox_user_access_view_homebox',
'access arguments' => array(
2,
TRUE,
),
'type' => MENU_CALLBACK,
);
// Admin related tasks
$items['admin/build/homebox'] = array(
'title' => 'Homebox',
'description' => 'List, edit, or add homebox pages.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_admin_new_page',
),
'access arguments' => array(
'administer homebox',
),
'file' => 'homebox.admin.inc',
);
$items['admin/build/homebox/edit/%homebox'] = array(
'title' => 'Edit page',
'page arguments' => array(
'homebox_admin_page',
4,
),
'access arguments' => array(
'administer homebox',
),
'type' => MENU_CALLBACK,
'file' => 'homebox.admin.inc',
);
$items['admin/build/homebox/layout/%homebox'] = array(
'title' => 'Layout',
'description' => 'Edit layout.',
'page callback' => 'homebox_layout',
'page arguments' => array(
4,
),
'access arguments' => array(
'administer homebox',
),
'file' => 'homebox.admin.inc',
'type' => MENU_CALLBACK,
);
$items['admin/build/homebox/flush/%homebox'] = array(
'title' => 'Flush user settings',
'description' => 'Clear all user\'s settings for a given homebox.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_admin_flush_form',
4,
),
'access arguments' => array(
'administer homebox',
),
'file' => 'homebox.admin.inc',
'type' => MENU_CALLBACK,
);
$items['admin/build/homebox/settings/%homebox'] = array(
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_configure_form',
4,
),
'access arguments' => array(
'administer homebox',
),
'type' => MENU_CALLBACK,
'file' => 'homebox.admin.inc',
);
$items['admin/build/homebox/export/%homebox'] = array(
'title' => 'Export',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_export_form',
4,
),
'access arguments' => array(
'administer homebox',
),
'type' => MENU_CALLBACK,
'file' => 'homebox.admin.inc',
);
$items['admin/build/homebox/delete/%homebox'] = array(
'title' => 'Delete page',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_admin_page_delete_confirm',
4,
),
'access arguments' => array(
'administer homebox',
),
'type' => MENU_CALLBACK,
'file' => 'homebox.admin.inc',
);
// Admin user settings
$items['admin/user/homebox'] = array(
'title' => 'User profile Homebox',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'homebox_user_settings_page',
),
'access arguments' => array(
'administer homebox',
),
'description' => 'Configure the intergration of Homebox and user profiles.',
'file' => 'homebox.admin.inc',
);
return $items;
}