function _views_create_menu_item in Views (for Drupal 7) 5
Helper function to add a menu item for a view.
2 calls to _views_create_menu_item()
- views_menu_inline_items in ./
views.module - views_menu_standard_items in ./
views.module - Add the menu items for all non-inline views to the menu
File
- ./
views.module, line 214
Code
function _views_create_menu_item(&$items, $view, $path, $local_task_type = MENU_NORMAL_ITEM, $args = array()) {
$title = filter_xss_admin(views_get_title($view, 'menu'));
$type = _views_menu_type($view);
if ($type == MENU_LOCAL_TASK || $type == MENU_DEFAULT_LOCAL_TASK) {
$weight = $view->menu_tab_weight;
}
$access = views_access($view);
$items[] = _views_menu_item($path, $title, $view, $args, $access, $type, $weight);
if ($type == MENU_DEFAULT_LOCAL_TASK) {
switch ($view->menu_tab_default_parent_type) {
case 'tab':
$parent_type = MENU_LOCAL_TASK;
break;
case 'normal':
$parent_type = MENU_NORMAL_ITEM;
break;
case 'existing':
$parent_type = 0;
break;
}
if ($parent_type) {
$title = filter_xss_admin(views_get_title($view, 'menu-parent'));
$weight = $view->menu_parent_tab_weight;
$items[] = _views_menu_item(dirname($path), $title, $view, $args, $access, $parent_type, $weight);
}
}
}