Implements hook_menu().
@todo Clarify the documentation for the per-plugin block admin links.
function block_menu() {
$default_theme = config('system.theme')
->get('default');
$items['admin/structure/block'] = array(
'title' => 'Blocks',
'description' => 'Configure what block content appears in your site\'s sidebars and other regions.',
'page callback' => 'block_admin_display',
'page arguments' => array(
$default_theme,
),
'access arguments' => array(
'administer blocks',
),
'file' => 'block.admin.inc',
);
$items['admin/structure/block/add/%/%'] = array(
'title' => 'Configure block',
'page callback' => 'block_admin_add',
'page arguments' => array(
4,
5,
),
'access arguments' => array(
'administer blocks',
),
'file' => 'block.admin.inc',
);
$items['admin/structure/block/manage/%block'] = array(
'title' => 'Configure block',
'page callback' => 'block_admin_edit',
'page arguments' => array(
4,
),
'access arguments' => array(
'administer blocks',
),
'file' => 'block.admin.inc',
);
$items['admin/structure/block/manage/%block/configure'] = array(
'title' => 'Configure block',
'type' => MENU_DEFAULT_LOCAL_TASK,
'context' => MENU_CONTEXT_INLINE,
);
$items['admin/structure/block/manage/%block/delete'] = array(
'title' => 'Delete block',
'type' => MENU_LOCAL_TASK,
'context' => MENU_CONTEXT_NONE,
'route_name' => 'block_admin_block_delete',
);
// Block administration is tied to the theme and plugin definition so
// that the plugin can appropriately attach to this URL structure.
// @todo D8: Use dynamic % arguments instead of static, hard-coded theme names
// and plugin IDs to decouple the routes from these dependencies and allow
// hook_menu_local_tasks() to check for the untranslated tab_parent path.
// @see http://drupal.org/node/1067408
$themes = list_themes();
foreach (drupal_container()
->get('plugin.manager.system.plugin_ui')
->getDefinitions() as $plugin_id => $plugin) {
list($plugin_base, $key) = explode(':', $plugin_id);
if ($plugin_base == 'block_plugin_ui') {
$theme = $themes[$key];
$items['admin/structure/block/list/' . $plugin_id] = array(
'title' => check_plain($theme->info['name']),
'page arguments' => array(
$key,
),
'type' => $key == $default_theme ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'access callback' => '_block_themes_access',
'access arguments' => array(
$key,
),
'file' => 'block.admin.inc',
);
$items['admin/structure/block/demo/' . $key] = array(
'title' => check_plain($theme->info['name']),
'page callback' => 'block_admin_demo',
'page arguments' => array(
$key,
),
'type' => MENU_CALLBACK,
'access callback' => '_block_themes_access',
'access arguments' => array(
$key,
),
'theme callback' => '_block_custom_theme',
'theme arguments' => array(
$key,
),
'file' => 'block.admin.inc',
);
}
}
return $items;
}