You are here

function video_multidownload_menu in Video 6.2

Same name and namespace in other branches
  1. 5 plugins/video_multidownload/video_multidownload.module \video_multidownload_menu()
  2. 6 plugins/video_multidownload/video_multidownload.module \video_multidownload_menu()

Implementation of hook_menu().

Parameters

$may_cache: boolean indicating whether cacheable menu items should be returned

Return value

array of menu information

File

plugins/video_multidownload/video_multidownload.module, line 32
Enable multiple file download in video module.

Code

function video_multidownload_menu() {
  $items = array();

  /* TODO
     Non menu code that was placed in hook_menu under the '!$may_cache' block
     so that it could be run during initialization, should now be moved to hook_init.
     Previously we called hook_init twice, once early in the bootstrap process, second
     just after the bootstrap has finished. The first instance is now called boot
     instead of init.

     In Drupal 6, there are now two hooks that can be used by modules to execute code
     at the beginning of a page request. hook_boot() replaces hook_boot() in Drupal 5
     and runs on each page request, even for cached pages. hook_boot() now only runs
     for non-cached pages and thus can be used for code that was previously placed in
     hook_menu() with $may_cache = FALSE:

     Dynamic menu items under a '!$may_cache' block can often be simplified
     to remove references to arg(n) and use of '%<function-name>' to check
     conditions. See http://drupal.org/node/103114.

     The title and description arguments should not have strings wrapped in t(),
     because translation of these happen in a later stage in the menu system.
  */
  $may_cache = true;
  if ($may_cache) {
    $items['admin/content/video/multidownload'] = array(
      'title' => 'Multidownload',
      'description' => 'Administer video_multidownload module settings',
      'page callback' => 'drupal_get_form',
      'page arguments' => array(
        'video_multidownload_settings_form',
      ),
      'access arguments' => array(
        'administer site configuration',
      ),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      if ($node = node_load(arg(1)) and $node->type == 'video') {
        if (isset($node->disable_multidownload) && !$node->disable_multidownload && ($node->use_play_folder || $node->download_folder != '')) {
          $items['node/' . '%' . '/multidownload'] = array(
            'title' => 'download other formats',
            'page callback' => 'video_multidownload_download',
            'access arguments' => array(
              'access video',
            ),
            'weight' => 7,
            'type' => MENU_LOCAL_TASK,
          );
        }
      }
    }
  }
  return $items;
}