You are here

function gallery_assist_menu in Gallery Assist 7

Same name and namespace in other branches
  1. 6 gallery_assist.module \gallery_assist_menu()

Implements hook_menu().

File

./gallery_assist.module, line 193
Extend drupal with gallery functionalities. Manage galleries.

Code

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

  // Administration.
  $items['admin/config/media/gallery_assist'] = array(
    'title' => 'Gallery Assist',
    'description' => 'Configure Gallery Assist.',
    'page callback' => 'gallery_assist_info',
    'access arguments' => array(
      TRUE,
    ),
    'file' => 'gallery_assist.admin.inc',
  );
  $items['admin/config/media/gallery_assist/info'] = array(
    'title' => 'Info',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items['admin/config/media/gallery_assist/assignments'] = array(
    'title' => 'Assignments',
    'description' => 'Configure settings per node type with GA functionality (assignment)',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_assignments_form',
    ),
    'access callback' => TRUE,
    'file' => 'gallery_assist.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );
  $i = 0;
  foreach (node_type_get_names() as $type => $name) {
    $menu_type = $i == 0 ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK;
    if (variable_get("gallery_assist_{$type}") == 1) {
      $items["admin/config/media/gallery_assist/assignments/{$type}"] = array(
        'title' => $name,
        'description' => "Administer the GA settings on {$name}.",
        'page callback' => 'drupal_get_form',
        'page arguments' => array(
          'gallery_assist_assignments_form',
          $type,
          $name,
        ),
        'access callback' => TRUE,
        'type' => $menu_type,
        'file' => 'gallery_assist.admin.inc',
        'weight' => $i,
      );
      ++$i;
    }
  }
  $items['admin/config/media/gallery_assist/global'] = array(
    'title' => 'Global',
    'description' => 'Global Gallery Assist settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_global_form',
    ),
    'access callback' => TRUE,
    'file' => 'gallery_assist.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );

  // Node edit.
  $items['node/%node/gallery'] = array(
    'title' => 'Gallery',
    'description' => '',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_gallery_node_form',
      1,
      2,
    ),
    'access callback' => gallery_assist_check_access(1),
    #'file' => 'gallery_assist.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  $items['node/%node/gallery/items'] = array(
    'title' => 'Items',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'access callback' => gallery_assist_check_access(1),
    'weight' => 1,
  );
  $items['node/%node/gallery/settings'] = array(
    'title' => 'Settings',
    'description' => '',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_gallery_node_form',
      1,
      2,
      3,
    ),
    'access callback' => gallery_assist_check_access(1),
    #'file' => 'gallery_assist.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
  );
  $items['node/%node/gallery/upload'] = array(
    'title' => 'Upload',
    'description' => '',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_gallery_node_form',
      1,
      2,
      3,
    ),
    'access callback' => gallery_assist_check_access(1),
    #'file' => 'gallery_assist.admin.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 3,
  );
  $items["node/%node/%/edit"] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_item_edit_form',
      1,
      2,
      3,
    ),
    'access callback' => TRUE,
  );
  $items["node/%node/cover/%"] = array(
    'page callback' => 'gallery_assist_set_cover',
    'page arguments' => array(
      1,
      1,
      3,
      2,
    ),
    'access callback' => TRUE,
    'file' => 'gallery_assist_form.inc',
  );
  $items["node/%node/%/delete"] = array(
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_item_delete_confirm',
      1,
      2,
      3,
    ),
    'access callback' => TRUE,
  );

  // Gallery Item
  //  $items["node/%/view/%"] = array(
  //    'page callback' => array('gallery_assist_item', 1, 2, 3),
  //    'access callback' => TRUE,
  //  );
  // Gallery Item
  //  $items["node/%/%"] = array(
  //    'page callback' => array('gallery_assist_item', 1, 2, 3),
  //    'access callback' => TRUE,
  //  );

  ################################################################################
  $items["node/%node/item/%gallery_assist_item"] = array(
    'title' => 'View',
    'page callback' => 'gallery_assist_item',
    'page arguments' => array(
      1,
      2,
      3,
    ),
    'access callback' => TRUE,
  );
  $items["node/%node/item/%gallery_assist_item/view"] = array(
    'title' => 'View',
    'page callback' => 'gallery_assist_item',
    'page arguments' => array(
      1,
      2,
      3,
    ),
    'access callback' => TRUE,
    #'access arguments' => array(TRUE),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
  );
  $items["node/%node/item/%gallery_assist_item/edit"] = array(
    'title' => 'Edit',
    #'page callback' => 'gallery_assist_item',

    #'page arguments' => array(1,2,3),
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_item_edit_form',
      1,
      2,
      3,
      4,
    ),
    'access callback' => FALSE,
    #'access arguments' => array(TRUE),
    'type' => MENU_LOCAL_TASK,
    'weight' => 1,
  );

  //  return $items;

  ################################################################################

  // Administration.
  $items['admin/config/media/gallery_assist/austoben'] = array(
    'title' => 'Austoben',
    'description' => 'Configure Gallery Assist.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'gallery_assist_austoben',
    ),
    'access arguments' => array(
      TRUE,
    ),
    'file' => 'gallery_assist.austoben.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 200,
  );
  return $items;
}