function video_menu in Video 5
Same name and namespace in other branches
- 6.5 video.module \video_menu()
- 6 video.module \video_menu()
- 6.2 video.module \video_menu()
- 6.3 video.module \video_menu()
- 6.4 video.module \video_menu()
- 7.2 video.module \video_menu()
Implementation of hook_menu().
Parameters
$may_cache: boolean indicating whether cacheable menu items should be returned
Return value
array of menu information
File
- ./
video.module, line 71 - Display video in Quicktime MOV, Realmedia RM, Flash FLV & SWF, or Windows Media WMV formats.
Code
function video_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'video',
'title' => t('videos'),
'callback' => 'video_page',
'access' => user_access('access video'),
'type' => MENU_SUGGESTED_ITEM,
);
$items[] = array(
'path' => 'video/feed',
'title' => t('videos feed'),
'callback' => 'video_feed',
'access' => user_access('access video'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'node/add/video',
'title' => t('Video'),
'callback' => 'video_add',
'access' => user_access('create video'),
);
$items[] = array(
'path' => 'admin/settings/video',
'title' => t('Video'),
'description' => t('Configure different aspects of the video module and its plugins'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'video_settings_form',
),
'access' => user_access('administer video'),
'type' => MENU_NORMAL_ITEM,
);
}
else {
//If $may_cache is false.
if (arg(0) == 'node' && is_numeric(arg(1))) {
if ($node = node_load(arg(1)) and $node->type == 'video') {
//enable the download tab only if it is supported
if (video_support_download($node)) {
$menu_type = variable_get('video_displaydownloadmenutab', 1) ? MENU_LOCAL_TASK : MENU_CALLBACK;
$items[] = array(
'path' => 'node/' . $node->nid . '/download',
'title' => t('Download'),
'callback' => 'video_download',
'callback arguments' => array(
$node,
),
'access' => user_access('access video') && node_access('view', $node, $user->uid),
'weight' => 5,
'type' => $menu_type,
);
}
}
}
}
return $items;
}