You are here

function bean_menu in Bean (for Drupal 7) 7

Implements hook_menu().

File

./bean.module, line 105
Block Entity

Code

function bean_menu() {
  $items = array();
  $items['block/add'] = array(
    'title' => 'Add Block',
    'page callback' => 'bean_add_page',
    'access arguments' => array(
      'add',
    ),
    'access callback' => 'bean_add_page_access',
    'file' => 'includes/bean.pages.inc',
  );
  foreach (bean_get_types() as $type) {
    if (!empty($type)) {
      $items['block/add/' . $type
        ->buildURL()] = array(
        'title' => $type
          ->getLabel(),
        'title callback' => 'check_plain',
        'page callback' => 'bean_add',
        'page arguments' => array(
          $type->type,
        ),
        'access callback' => 'bean_access',
        'access arguments' => array(
          'create',
          $type->type,
        ),
        'file' => 'includes/bean.pages.inc',
      );
    }
  }
  $items['block/%bean_delta'] = array(
    'title' => 'Block',
    'page callback' => 'bean_view_page',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'view bean page',
    ),
    'file' => 'includes/bean.pages.inc',
  );
  $items['block/%bean_delta/view'] = array(
    'title' => 'View',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
    'weight' => -20,
  );
  $items['block/%bean_delta/edit'] = array(
    'title' => 'Edit Block',
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
    'page callback' => 'bean_edit',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'update',
      'bean',
      1,
    ),
    'access callback' => 'entity_access',
    'file' => 'includes/bean.pages.inc',
  );
  $items['block/%bean_delta/delete'] = array(
    'title' => 'Delete Block',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'bean_delete_confirm',
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'delete',
      'bean',
      1,
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
    'file' => 'includes/bean.pages.inc',
  );
  $items['block/%bean_delta/revisions'] = array(
    'title' => 'Revisions',
    'page callback' => 'bean_revisions_page',
    'page arguments' => array(
      1,
    ),
    'access arguments' => array(
      'view bean revisions',
    ),
    'file' => 'includes/bean.pages.inc',
    'type' => MENU_LOCAL_TASK,
  );
  $items['block/%bean_delta/revisions/%'] = array(
    'title callback' => 'bean_revision_title',
    'title arguments' => array(
      1,
    ),
    'page callback' => 'bean_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'bean',
      1,
    ),
    'file' => 'includes/bean.pages.inc',
    'load arguments' => array(
      3,
    ),
  );
  $items['block/%bean_delta/revisions/%/view'] = array(
    'title' => 'View',
    'page callback' => 'bean_view',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'view',
      'bean',
      1,
    ),
    'file' => 'includes/bean.pages.inc',
    'load arguments' => array(
      3,
    ),
    'weight' => -10,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
  );
  $items['block/%bean_delta/revisions/%/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'bean_edit',
    'page arguments' => array(
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'update',
      'bean',
      1,
    ),
    'file' => 'includes/bean.pages.inc',
    'load arguments' => array(
      3,
    ),
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['block/%bean_delta/revisions/%/set-active'] = array(
    'title' => 'Set active',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'bean_set_default_confirm',
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'update',
      'bean',
      1,
    ),
    'file' => 'includes/bean.pages.inc',
    'load arguments' => array(
      3,
    ),
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
  );
  $items['block/%bean_delta/revisions/%/delete'] = array(
    'title' => 'Delete',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'bean_delete_revision_confirm',
      1,
    ),
    'access callback' => 'entity_access',
    'access arguments' => array(
      'delete',
      'bean',
      1,
    ),
    'file' => 'includes/bean.pages.inc',
    'load arguments' => array(
      3,
    ),
    'weight' => 1,
    'type' => MENU_LOCAL_TASK,
    'context' => MENU_CONTEXT_NONE,
  );
  $items['admin/content/blocks'] = array(
    'title' => 'Blocks',
    'description' => 'Manage blocks used on your site.',
    'page callback' => 'bean_list',
    'access arguments' => array(
      'access bean overview',
    ),
    'file' => 'includes/bean.pages.inc',
    'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM,
  );
  if (module_exists('devel')) {
    $devel_path = drupal_get_path('module', 'devel');
    $items['block/%bean_delta/devel'] = array(
      'title' => 'Devel',
      'page callback' => 'devel_load_object',
      'page arguments' => array(
        'bean',
        1,
      ),
      'access arguments' => array(
        'administer beans',
      ),
      'type' => MENU_LOCAL_TASK,
      'file' => 'devel.pages.inc',
      'file path' => $devel_path,
      'weight' => 100,
    );
    $items['block/%bean_delta/devel/load'] = array(
      'title' => 'Load',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items['block/%bean_delta/devel/render'] = array(
      'title' => 'Render',
      'page callback' => 'devel_render_object',
      'page arguments' => array(
        'bean',
        1,
      ),
      'access arguments' => array(
        'administer beans',
      ),
      'file' => 'devel.pages.inc',
      'file path' => $devel_path,
      'type' => MENU_LOCAL_TASK,
      'weight' => 100,
    );
  }
  return $items;
}