You are here

function dynamic_banner_menu in Dynamic Banner 7.2

Same name and namespace in other branches
  1. 6 dynamic_banner.module \dynamic_banner_menu()
  2. 7 dynamic_banner.module \dynamic_banner_menu()
  3. 8.x dynamic_banner.module \dynamic_banner_menu()

Implements hook_menu(). it is key to note here access arguments is referring to permissions

File

./dynamic_banner.module, line 62
Distributed under GNU GPL version 3

Code

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

  // This is the root path and will be used to add dynamic banner to the admin page
  $items['admin/structure/banners'] = array(
    'title' => 'Dynamic Banner',
    'description' => 'Configure the Dynamic Banner.',
    'page callback' => 'dynamic_banner_admin_page',
    'access arguments' => array(
      'administer dynamic banner',
    ),
  );

  // The dynamic banner module settings page
  $items['admin/structure/banners/settings'] = array(
    'title' => 'Settings',
    'description' => 'A page for the dynamic banner settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_banner_settings',
    ),
    'access arguments' => array(
      'administer dynamic banner',
    ),
    'type' => MENU_LOCAL_ACTION,
  );

  // This will be the page to delete a selected banner
  $items['admin/structure/banners/delete/%'] = array(
    'title' => 'Delete Banner',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_banner_admin_delete_confirm',
      4,
    ),
    'access arguments' => array(
      'administer dynamic banner',
    ),
    'type' => MENU_CALLBACK,
  );

  // the defaulted page to load on menu click
  $items['admin/structure/banners/list'] = array(
    'title' => 'List Banners',
    'weight' => -10,
  );

  /**
   * These next three are the same destination but since we want the user to know
   * We add them to the menu deal with logic from inside the form
   */
  $items['admin/structure/banners/add/0'] = array(
    'title' => 'Add Banner',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_banner_admin_form',
    ),
    'access arguments' => array(
      'administer dynamic banner',
    ),
    'type' => MENU_LOCAL_ACTION,
  );
  $items['admin/structure/banners/default'] = array(
    'title' => 'Default Banner',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_banner_admin_form',
      3,
    ),
    'access arguments' => array(
      'administer dynamic banner',
    ),
    'type' => MENU_LOCAL_ACTION,
  );

  // This will be the page to edit a banner from a form
  $items['admin/structure/banners/edit/%'] = array(
    'title' => 'Edit Banner',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'dynamic_banner_admin_form',
      4,
    ),
    'access arguments' => array(
      'administer dynamic banner',
    ),
  );
  return $items;
}