1 layout.module layout_menu()

Implements hook_menu().

File

core/modules/layout/layout.module, line 73
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',
  );
  $items['admin/structure/layouts'] += $base;

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

  $items['admin/structure/layouts/settings'] = array(
    'title' => 'Layout 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',
  );
  $items['admin/structure/layouts/settings'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/add'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/edit'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/configure'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/delete'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/delete'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/select-widths'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/configure'] += $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',
  );
  $items['admin/structure/layouts/settings/flexible-template/%layout_flexible_tempstore/row/%/configure/%'] += $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',
  );
  $items['admin/structure/layouts/settings/toggle/%/enable'] += $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',
  );
  $items['admin/structure/layouts/settings/toggle/%/disable'] += $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',
  );
  $items['admin/structure/layouts/reorder'] += $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',
  );
  $items['admin/structure/layouts/add'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore'] += $base;

  // @deprecated: Remove backwards-compatibility redirect in 2.0.
  $items['admin/structure/layouts/manage/%layout_tempstore/edit'] = array(
    'page callback' => 'system_redirect_deprecated_page',
    '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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/blocks'] += $base;

  // @deprecated: Remove backwards-compatibility redirect in 2.0.
  $items['admin/structure/layouts/manage/%layout_tempstore/settings'] = array(
    'page callback' => 'system_redirect_deprecated_page',
    '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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/configure'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/add-block/%/%'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/configure-region/%/%'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/edit-title/editor/title'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/configure-block/%/%layout_tempstore_block'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout/configure-redirect/%'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/remove-block/%/%layout_tempstore_block'] += $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/toggle-block-status/%/%layout_tempstore_block'] = array(
    'title' => 'Disable block',
    'load arguments' => array(4),
    'page callback' => 'layout_block_disable_page',
    'page arguments' => array(4, 7, 6),
    'file' => 'layout.admin.inc',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/toggle-block-status/%/%layout_tempstore_block'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/clone'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/enable'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/disable'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/delete'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/break-lock'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/context/add'] += $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/relationship/add'] = array(
    'title' => 'Add relationship',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_context_relationship_add_form', 4),
    'type' => MENU_CALLBACK,
    'file' => 'layout.context.admin.inc',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/relationship/add'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/context/edit/layout/%'] += $base;

  $items['admin/structure/layouts/manage/%layout_tempstore/relationship/edit/layout/%'] = array(
    'title' => 'Configure relationship',
    'page callback' => 'backdrop_get_form',
    'page arguments' => array('layout_context_relationship_add_form', 4, 8),
    'type' => MENU_CALLBACK,
    'file' => 'layout.context.admin.inc',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/relationship/edit/layout/%'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/condition/add'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/condition/edit/layout/%'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/condition/add/%layout_tempstore_block'] += $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',
  );
  $items['admin/structure/layouts/manage/%layout_tempstore/condition/edit/%layout_tempstore_block/%'] += $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',
  );
  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item'] += $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',
  );
  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/settings'] += $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',
  );
  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/break-lock'] += $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',
  );
  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/condition/add'] += $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',
  );
  $items['admin/structure/layouts/menu/%layout_tempstore_menu_item/condition/edit/%'] += $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',
  );

  // Create layout tabs for all possible entity bundles. Limit to entities that
  // define a menu context path.
  $all_info = _layout_get_all_info('layout_context');
  $entity_names = array();
  foreach ($all_info as $entity_type_name => $context_info) {
    if (!empty($context_info['menu paths'])) {
      $entity_names[] = $entity_type_name;
    }
  }

  foreach (entity_get_info() as $entity_type => $entity_info) {
    if (in_array($entity_type, $entity_names)) {
      foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
        if (isset($bundle_info['admin'])) {
          $path = $bundle_info['admin']['path'];
          if (isset($bundle_info['admin']['bundle argument'])) {
            $bundle_arg = $bundle_info['admin']['bundle argument'];
          }
          else {
            $bundle_arg = $bundle_name;
          }

          $access = array(
            'access callback' => 'user_access',
            'access arguments' => array('administer layouts'),
          );

          $items["$path/layouts"] = array(
            'title' => 'Manage layouts',
            'page callback' => 'backdrop_get_form',
            'page arguments' => array('layout_entity_admin_form', $entity_type, $bundle_arg),
            'type' => MENU_LOCAL_TASK,
            'weight' => 2,
            'file' => 'layout.entity.admin.inc',
          ) + $access;
          $items["$path/layouts/add"] = array(
            'title' => 'Add layout',
            'title callback' => 'layout_entity_menu_title',
            'title arguments' => array($entity_type, $bundle_arg),
            'page callback' => 'backdrop_get_form',
            'page arguments' => array('layout_entity_admin_add_form', $entity_type, $bundle_arg),
            'file' => 'layout.entity.admin.inc',
            'type' => MENU_LOCAL_ACTION,
          ) + $access;
        }
      }
    }
  }

  return $items;
}