1 layout.module layout_menu()

Implements hook_menu().

File

core/modules/layout/layout.module, line 63
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_menu() {
  $items = array();
  $base = array(
    'access arguments' => array('administer layouts'),
    'theme callback' => 'ajax_base_page_theme',
  );

  $items['admin/structure/layouts'] = array(
    'title' => 'Layouts',
    'description' => 'Create new landing pages or modify the layout of existing pages on your site.',
    'page callback' => 'layout_list_page',
    'type' => MENU_NORMAL_ITEM,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/list'] = array(
    'title' => 'List layouts',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/settings'] = array(
    'title' => 'Templates',
    'description' => 'Manage layout templates.',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_settings_page'),
    'type' => MENU_LOCAL_TASK,
    'weight' => 20,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/add'] = array(
    'title' => 'Add flexible layout template',
    'page callback' => 'layout_flexible_template_settings_add_form',
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_LOCAL_ACTION,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/edit'] = array(
    'title' => 'Configure flexible layout template',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_settings_edit_form', 5),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/configure'] = array(
    'title' => 'Configure flexible layout template',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_configure_form', 5),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/delete'] = array(
    'title' => 'Delete flexible layout template',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_delete_form', 5),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_NORMAL_ITEM,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/delete'] = array(
    'title' => 'Delete row',
    'page callback' => 'layout_flexible_template_delete_row',
    'page arguments' => array(5, 7),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_CALLBACK,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/select-widths'] = array(
    'title' => 'Choose region widths',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_region_style_select', 5, 7),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_CALLBACK,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/configure'] = array(
    'title' => 'Add row',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_edit_row_form', 5, 7),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_CALLBACK,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/configure/%'] = array(
    'title' => 'Add row',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_flexible_template_edit_row_form', 5, 7, 9),
    'access arguments' => array('administer flexible templates'),
    'type' => MENU_CALLBACK,
    'weight' => -10,
    'file' => 'layout.flexible.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/toggle/%/enable'] = array(
    'title' => 'Enable layout template',
    'page callback' => 'layout_template_toggle_enabled',
    'page arguments' => array(5, TRUE),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/settings/toggle/%/disable'] = array(
    'title' => 'Disable layout template',
    'page callback' => 'layout_template_toggle_enabled',
    'page arguments' => array(5, FALSE),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/reorder'] = array(
    'title' => 'Reorder',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_reorder_form'),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/add'] = array(
    'title' => 'Add layout',
    'page callback' => 'layout_add_page',
    'page arguments' => array(),
    'type' => MENU_LOCAL_ACTION,
    'weight' => -10,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore'] = array(
    'title' => 'Manage blocks',
    'title callback' => 'layout_page_title',
    'title arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_content_form', 4),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'layout.admin.inc',
  ) + $base;

  // @deprecated: Remove backwards-compatibility redirect in 2.0.
  $items['admin/structure/layouts/manage/%layout_tempstore/edit'] = array(
    'page callback' => 'backdrop_goto_deprecated',
    'page arguments' => array('admin/structure/layouts/manage/%layout_tempstore/blocks'),
    'access arguments' => array('administer layouts'),
    'type' => MENU_CALLBACK,
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/blocks'] = array(
    'title' => 'Manage blocks',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => 0,
    'file' => 'layout.admin.inc',
  ) + $base;

  // @deprecated: Remove backwards-compatibility redirect in 2.0.
  $items['admin/structure/layouts/manage/%layout_tempstore/settings'] = array(
    'page callback' => 'backdrop_goto_deprecated',
    'page arguments' => array('admin/structure/layouts/manage/%layout_tempstore/configure'),
    'access arguments' => array('administer layouts'),
    'type' => MENU_CALLBACK,
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/configure'] = array(
    'title' => 'Configure layout',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_settings_form', 4),
    'type' => MENU_LOCAL_TASK,
    'weight' => 10,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/add-block/%/%'] = array(
    'title' => 'Add block',
    'page callback' => 'layout_block_add_page',
    'page arguments' => array(4, 6, 7),
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/configure-region/%/%'] = array(
    'title' => 'Configure region',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_configure_region_page', 4, 6, 7),
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/edit-title/editor/title'] = array(
    'title' => 'Configure page title',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_title_settings_form', 4),
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/configure-block/%/%layout_tempstore_block'] = array(
    'title' => 'Configure block',
    'load arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_block_configure_form', 4, 7, 6),
    'file' => 'layout.admin.inc',
  ) + $base;

  // This shortcut path does not use layout_tempstore, for efficiency when
  // checking access to this path from contextual links. To work as a contextual
  // link, we have to specify the context and also set the type to be a
  // MENU_LOCAL_TASK, even though this page never shows up as a tab anywhere.
  $items['admin/structure/layouts/manage/%layout/configure-redirect/%'] = array(
    'title' => 'Configure block',
    'load arguments' => array(4),
    'page callback' => 'layout_block_configure_redirect',
    'page arguments' => array(4, 6),
    'context' => MENU_CONTEXT_INLINE,
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/remove-block/%/%layout_tempstore_block'] = array(
    'title' => 'Remove block',
    'load arguments' => array(4),
    'page callback' => 'layout_block_remove_page',
    'page arguments' => array(4, 7, 6),
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/clone'] = array(
    'title' => 'Clone layout',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_clone_form', 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/enable'] = array(
    'page callback' => 'layout_toggle_enabled',
    'page arguments' => array(4, TRUE),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/disable'] = array(
    'page callback' => 'layout_toggle_enabled',
    'page arguments' => array(4, FALSE),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/delete'] = array(
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_delete_form', 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/break-lock'] = array(
    'page callback' => 'layout_break_lock_page',
    'page arguments' => array(4, 'layout'),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/context/add'] = array(
    'title' => 'Add context',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_context_add_form', 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.context.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/context/edit/layout/%'] = array(
    'title' => 'Configure context',
    'load arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_context_add_form', 4, 8),
    'type' => MENU_CALLBACK,
    'file' => 'layout.context.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/condition/add'] = array(
    'title' => 'Add visibility condition',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/condition/edit/layout/%'] = array(
    'title' => 'Configure condition',
    'load arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', 4, NULL, NULL, 8),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/condition/add/%layout_tempstore_block'] = array(
    'title' => 'Add visibility condition',
    'load arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', 4, 7),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/condition/edit/%layout_tempstore_block/%'] = array(
    'title' => 'Configure condition',
    'load arguments' => array(4),
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', 4, 7, NULL, 8),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item'] = array(
    'title' => 'Menu settings',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_menu_item_form', 4),
    'type' => MENU_NORMAL_ITEM,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/settings'] = array(
    'title' => 'Menu settings',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -1,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/break-lock'] = array(
    'page callback' => 'layout_break_lock_page',
    'page arguments' => array(4, 'menu_item'),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/condition/add'] = array(
    'title' => 'Add visibility condition',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', NULL, NULL, 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/condition/edit/%'] = array(
    'title' => 'Configure condition',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_condition_add_form', NULL, NULL, 4, 7),
    'type' => MENU_CALLBACK,
    'file' => 'layout.admin.inc',
  ) + $base;

  // Add menu entries for each custom layout path.
  foreach (layout_menu_item_load_all() as $menu_item) {
    if (!empty($menu_item->disabled)) {
      continue;
    }

    $path = array();
    $page_arguments = array($menu_item->name);
    $access_arguments = array($menu_item->name);
    $load_arguments = array($menu_item->name, '%map', '%index');

    // Replace placeholders with named placeholders for known contexts.
    foreach (explode('/', $menu_item->path) as $position => $bit) {
      $placeholder = $bit;
      if (strpos($bit, '%') === 0) {
        $placeholder = '%layout_path';
      }

      $path[] = $placeholder;
      $page_arguments[] = $position;
      $access_arguments[] = $position;
    }

    $menu_path = implode('/', $path);
    $items[$menu_path] = layout_page_menu_item($menu_item->menu, $access_arguments, $page_arguments, $load_arguments);

    // Add a parent menu item if one is configured.
    if (isset($menu_item->menu['type']) && $menu_item->menu['type'] == 'default tab') {
      array_pop($path);
      $parent_path = implode('/', $path);
      $items[$parent_path] = layout_page_menu_item($menu_item->menu['parent'], $access_arguments, $page_arguments, $load_arguments);
    }
  }

  // A page in the Reports section to list all blocks and their modules.
  $items['admin/reports/blocks'] = array(
    'title' => 'Blocks',
    'description' => 'Overview of all blocks and their modules.',
    'page callback' => 'layout_block_list',
    'access callback' => 'user_access',
    'access arguments' => array('administer layouts'),
    'file' => 'layout.admin.inc',
  );

  return $items;
}