function views_bulk_operations_menu in Views Bulk Operations (VBO) 5
Same name and namespace in other branches
- 6 views_bulk_operations.module \views_bulk_operations_menu()
Implementation of hook_menu().
File
- ./
views_bulk_operations.module, line 52 - Allow bulk node operations directly within views.
Code
function views_bulk_operations_menu($may_cache) {
$items = array();
if ($may_cache) {
// no static menu entries
}
else {
if (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'views') {
$view_name = arg(3);
$path = 'admin/build/views/' . $view_name . '/operations';
}
else {
$urls = views_menu(false);
$strlenview = strlen('/view');
if ($urls) {
foreach ($urls as $url) {
if (strrpos($url['path'], '/view') == strlen($url['path']) - $strlenview) {
$view_name = $url['callback arguments'][0];
$path = substr($url['path'], 0, -$strlenview) . '/operations';
}
}
}
}
$view = views_get_view($view_name);
if ($view && isset($view->page_type) && $view->page_type == 'bulk') {
$items[] = array(
'path' => $path,
'title' => t('Settings'),
'description' => t('Select the operations to be displayed in the view and other settings.'),
'access' => user_access('administer views'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'views_bulk_operations_view_settings',
$view,
),
'type' => MENU_LOCAL_TASK,
'weight' => 10,
);
}
}
return $items;
}