You are here

function ad_ui_menu in Advertisement 7.2

Implements hook_menu().

File

./ad_ui.module, line 7

Code

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

  // TODO: ??
  // Note: admin/commerce/products will be created by Views.
  $items['admin/ad'] = array(
    'title' => 'Advertisements',
    'description' => 'Add a new advertisement.',
    'page callback' => 'ad_ui_add_page',
    'access callback' => 'ad_ui_add_any_access',
    'file' => 'includes/ad_ui.inc',
  );

  // Add an ad.
  $items['admin/ad/add'] = array(
    'title' => 'Add an advertisement',
    'description' => 'Add a new advertisement.',
    'page callback' => 'ad_ui_add_page',
    'access callback' => 'ad_ui_add_any_access',
    'file' => 'includes/ad_ui.inc',
  );

  /*
   * TODO: Get ad_create() working.
    foreach (ad_types() as $type => $ad_type) {
      $items['admin/ad/add/' . $type] = array(
        'title' => $ad_type->name,
        'title callback' => 'check_plain',
        'description' => $ad_type->description,
        'page callback' => 'drupal_get_form',
        'page arguments' => array('ad_ui_form', ad_create($type)),
        'access callback' => 'ad_access',
        'access arguments' => array('create', $type),
        'file' => 'includes/ad_ui.inc',
      );
    }
  */
  $items['admin/ad/%ad_type/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'ad_ui_form',
      3,
    ),
    'access callback' => 'ad_access',
    'access arguments' => array(
      'update',
      3,
    ),
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'file' => 'includes/ad_ui.inc',
  );
  $items['admin/ad/%ad_type/delete'] = array(
    'title' => 'Delete an advertisement',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'ad_ui_delete_form',
      3,
    ),
    'access callback' => 'ad_access',
    'access arguments' => array(
      'update',
      3,
    ),
    'file' => 'includes/ad_ui.inc',
  );
  $items['admin/ad/types'] = array(
    'title' => 'Advertisement types',
    'description' => 'Manage advertisement types.',
    'page callback' => 'ad_ui_types_overview',
    'access arguments' => array(
      'administer advertisements',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
    'file' => 'includes/ad_ui.types.inc',
  );
  $items['admin/ad/types/add'] = array(
    'title' => 'Add advertisement type',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'ad_ui_type_form',
      ad_type_new(),
    ),
    'access arguments' => array(
      'administer ad types',
    ),
    'type' => MENU_LOCAL_ACTION | MENU_VISIBLE_IN_BREADCRUMB,
    'file' => 'includes/ad_ui.types.inc',
  );
  $items['admin/ad/types/%ad_type'] = array(
    'title callback' => 'ad_type_title',
    'title arguments' => array(
      4,
    ),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'ad_ui_type_form',
      4,
    ),
    'access arguments' => array(
      'administer ad types',
    ),
    'type' => MENU_CALLBACK,
    'file' => 'includes/ad_ui.types.inc',
  );
  $items['admin/ad/types/%ad_type/edit'] = array(
    'title' => 'Edit',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['admin/ad/types/%ad_type/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'ad_ui_type_delete_form',
      4,
    ),
    'access arguments' => array(
      'administer ad types',
    ),
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_INLINE,
    'weight' => 10,
    'file' => 'includes/ad_ui.types.inc',
  );
  return $items;
}