You are here

function media_library_menu in Media Library 6

Same name and namespace in other branches
  1. 7 media_library.module \media_library_menu()

Implementation of hook_menu()

File

./media_library.module, line 202
Main Media Library module file.

Code

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

  // Main settings
  $items['admin/settings/media-library'] = array(
    'title' => t('Media Library'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'media_library_admin',
    ),
    'access arguments' => array(
      'administer media library',
    ),
    'file' => 'media_library.admin.inc',
  );
  $items['admin/settings/media-library/main'] = array(
    'title' => t('General'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

  // Automated per-media settings tab
  $module_info = module_invoke_all('media_types');
  foreach ($module_info as $type => $info) {
    if (isset($info['settings'])) {
      $items['admin/settings/media-library/' . $type] = array(
        'title' => $info['title'],
        'description' => $info['description'],
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          $info['settings'],
        ),
        'access arguments' => array(
          'administer media library',
        ),
        'type' => MENU_LOCAL_TASK,
      );
    }
  }

  /* Our main form (modal) */
  $items['media-library/main'] = array(
    'title' => t('Add Media Content (Ajax)'),
    'page callback' => 'media_library_modal',
    'access arguments' => array(
      'insert media',
    ),
    'file' => 'media_library.modal.inc',
    'type' => MENU_CALLBACK,
  );
  $items['media-library/main/add/%'] = array(
    'title' => t('Add Media Content (Ajax)'),
    'page callback' => 'media_library_modal_add',
    'page arguments' => array(
      3,
    ),
    'access arguments' => array(
      'insert media',
    ),
    'file' => 'media_library.modal.inc',
    'type' => MENU_CALLBACK,
  );

  // Ajax utilities
  $items['media-library/preview/%'] = array(
    'title' => t('Generates a preview for ajax'),
    'page callback' => 'media_library_ajax_preview',
    'page arguments' => array(
      2,
    ),
    //TODO: think about a permission here
    'access arguments' => array(
      'insert media',
    ),
    'file' => 'media_library.modal.inc',
    'type' => MENU_CALLBACK,
  );
  return $items;
}