You are here

function video_menu in Video 6

Same name and namespace in other branches
  1. 5 video.module \video_menu()
  2. 6.5 video.module \video_menu()
  3. 6.2 video.module \video_menu()
  4. 6.3 video.module \video_menu()
  5. 6.4 video.module \video_menu()
  6. 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 47
video.module

Code

function video_menu() {
  global $user;
  $items = array();
  $items['video'] = array(
    'title' => 'videos',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'video_page',
    ),
    'access arguments' => array(
      'access video',
    ),
    'type' => MENU_SUGGESTED_ITEM,
  );
  $items['video/feed'] = array(
    'title' => 'videos feed',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'video_feed',
    ),
    'access arguments' => array(
      'access video',
    ),
    'type' => MENU_CALLBACK,
  );
  $items["node/add/video"] = array(
    'title' => 'Video',
    'description' => 'Allow a variety of video formats to be posted as nodes in your site',
    'page callback' => 'video_add',
    'access arguments' => array(
      'create video',
    ),
  );
  $items['admin/settings/video'] = array(
    'title' => 'Video',
    'description' => 'Configure different aspects of the video module and its plugins',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'video_settings_form',
    ),
    'access arguments' => array(
      'administer video',
    ),
    'type' => MENU_NORMAL_ITEM,
  );
  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['node/' . $node->nid . '/download'] = array(
          'title' => 'Download',
          'page callback' => 'video_download',
          'page arguments' => array(
            $node,
          ),
          'access arguments' => array(
            'access video',
          ) && node_access('view', $node, $user->uid),
          'weight' => 5,
          'type' => $menu_type,
        );
      }
    }
  }
  return $items;
}