You are here

function boxes_menu in Boxes 7.2

Same name and namespace in other branches
  1. 6 boxes.module \boxes_menu()
  2. 7 boxes.module \boxes_menu()

Implements hook_menu().

File

./boxes.module, line 101

Code

function boxes_menu() {
  $items = array();
  $items['block/add'] = array(
    'title' => 'Add Block',
    'page callback' => 'boxes_add_page',
    'access arguments' => array(
      'add',
    ),
    'access callback' => 'boxes_add_page_access',
    'file' => 'includes/boxes.pages.inc',
  );
  foreach (boxes_get_types() as $type) {
    if (!empty($type)) {
      $items['block/add/' . $type
        ->buildURL()] = array(
        'title' => $type
          ->getLabel(),
        'title callback' => 'check_plain',
        'page callback' => 'boxes_add',
        'page arguments' => array(
          $type->type,
        ),
        'access arguments' => array(
          'create any ' . $type->type . ' boxes',
        ),
        'file' => 'includes/boxes.pages.inc',
      );
    }
  }
  $items['block/%boxes_delta'] = array(
    'title' => 'Block',
    'page callback' => 'boxes_view',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'edit',
      1,
    ),
    'access callback' => 'boxes_access',
    'file' => 'includes/boxes.pages.inc',
  );
  $items['block/%boxes_delta/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
    'weight' => -20,
  );
  $items['block/%boxes_delta/edit'] = array(
    'title' => 'Edit',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'page callback' => 'boxes_edit',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'edit',
      1,
    ),
    'access callback' => 'boxes_access',
    'file' => 'includes/boxes.pages.inc',
  );
  $items['block/%boxes_delta/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'boxes_delete_confirm',
      1,
    ),
    'access callback' => 'boxes_access',
    'access arguments' => array(
      'delete',
      1,
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
    'file' => 'includes/boxes.pages.inc',
  );
  $items['admin/content/blocks'] = array(
    'title' => 'Blocks',
    'description' => 'Manage blocks used on your site.',
    'page callback' => 'boxes_list',
    'access arguments' => array(
      'administer boxes',
    ),
    'file' => 'includes/boxes.pages.inc',
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
  );
  if (module_exists('devel')) {
    $devel_path = drupal_get_path('module', 'devel');
    $items['block/%boxes_delta/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'devel_load_object',
      'page arguments' => array(
        'boxes',
        1,
      ),
      'access arguments' => array(
        'administer boxes',
      ),
      'type' => MENU_LOCAL_TASK,
      'file' => 'devel.pages.inc',
      'file path' => $devel_path,
      'weight' => 100,
    );
    $items['block/%boxes_delta/devel/load'] = array(
      'title' => 'Load',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items['block/%boxes_delta/devel/render'] = array(
      'title' => 'Render',
      'page callback' => 'devel_render_object',
      'page arguments' => array(
        'boxes',
        1,
      ),
      'access arguments' => array(
        'administer boxes',
      ),
      'file' => 'devel.pages.inc',
      'file path' => $devel_path,
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
  }
  return $items;
}