diff --git a/core/modules/system/lib/Drupal/system/SystemManager.php b/core/modules/system/lib/Drupal/system/SystemManager.php index 2712169..86712a7 100644 --- a/core/modules/system/lib/Drupal/system/SystemManager.php +++ b/core/modules/system/lib/Drupal/system/SystemManager.php @@ -124,4 +124,31 @@ public function getMaxSeverity(&$requirements) { return $severity; } + /** + * Loads the contents of a menu block. + * + * This function is often a destination for these blocks. + * For example, 'admin/structure/types' needs to have a destination to be + * valid in the Drupal menu system, but too much information there might be + * hidden, so we supply the contents of the block. + * + * @return array + * A render array suitable for drupal_render. + */ + public function getBlockContents() { + $item = menu_get_item(); + if ($content = system_admin_menu_block($item)) { + $output = array( + '#content' => $content, + '#theme' => 'admin_block_content', + ); + } + else { + $output = array( + '#type' => 'markup', + '#markup' => t('You do not have any administrative items.'), + ); + } + return $output; + } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php index afb7e32..f81c316 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/MenuRouterTest.php @@ -137,15 +137,6 @@ function testThemeCallbackInheritance() { } /** - * Test that 'page callback', 'file' and 'file path' keys are properly - * inherited from parent menu paths. - */ - function testFileInheritance() { - $this->drupalGet('admin/config/development/file-inheritance'); - $this->assertText('File inheritance test description', 'File inheritance works.'); - } - - /** * Test path containing "exotic" characters. */ function testExoticPath() { diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 957db86..6a38d2d 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -69,27 +69,7 @@ function system_admin_config_page() { } } -/** - * Provide a single block from the administration menu as a page. - * - * This function is often a destination for these blocks. - * For example, 'admin/structure/types' needs to have a destination to be valid - * in the Drupal menu system, but too much information there might be - * hidden, so we supply the contents of the block. - * - * @return - * The output HTML. - */ -function system_admin_menu_block_page() { - $item = menu_get_item(); - if ($content = system_admin_menu_block($item)) { - $output = theme('admin_block_content', array('content' => $content)); - } - else { - $output = t('You do not have any administrative items.'); - } - return $output; -} + /** * Menu callback; displays a listing of all themes. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 238f303..be2c608 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -769,9 +769,7 @@ function system_menu() { 'description' => 'Media tools.', 'position' => 'left', 'weight' => -10, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/media/file-system'] = array( 'title' => 'File system', @@ -792,9 +790,7 @@ function system_menu() { 'description' => 'Tools related to web services.', 'position' => 'right', 'weight' => 0, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/services/rss-publishing'] = array( 'title' => 'RSS publishing', @@ -808,9 +804,7 @@ function system_menu() { 'description' => 'Development tools.', 'position' => 'right', 'weight' => -10, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/development/maintenance'] = array( 'title' => 'Maintenance mode', @@ -837,9 +831,7 @@ function system_menu() { 'description' => 'Regional settings, localization and translation.', 'position' => 'left', 'weight' => -5, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/regional/settings'] = array( 'title' => 'Regional settings', @@ -882,9 +874,7 @@ function system_menu() { 'description' => 'Local site search, metadata and SEO.', 'position' => 'left', 'weight' => -10, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); // System settings. @@ -893,9 +883,7 @@ function system_menu() { 'description' => 'General system related configuration.', 'position' => 'right', 'weight' => -20, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/system/site-information'] = array( 'title' => 'Site information', @@ -914,9 +902,7 @@ function system_menu() { 'title' => 'User interface', 'description' => 'Tools that enhance the user interface.', 'position' => 'right', - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', 'weight' => -15, ); $items['admin/config/workflow'] = array( @@ -924,29 +910,23 @@ function system_menu() { 'description' => 'Content workflow, editorial workflow tools.', 'position' => 'right', 'weight' => 5, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); $items['admin/config/content'] = array( 'title' => 'Content authoring', 'description' => 'Settings related to formatting and authoring content.', 'position' => 'left', 'weight' => -15, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_config', ); // Reports. $items['admin/reports'] = array( 'title' => 'Reports', 'description' => 'View reports, updates, and errors.', - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access site reports'), + 'route_name' => 'system_admin_reports', 'weight' => 5, 'position' => 'left', - 'file' => 'system.admin.inc', ); $items['admin/reports/status'] = array( 'title' => 'Status report', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 1e09f79..8c8d824 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -1,12 +1,3 @@ -system.cron: - pattern: '/cron/{key}' - defaults: - _controller: '\Drupal\system\CronController::run' - requirements: - _access_system_cron: 'TRUE' -system.machine_name_transliterate: - pattern: '/machine_name/transliterate' - defaults: _controller: '\Drupal\system\MachineNameController::transliterate' requirements: _permission: 'access content' diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index b5c0c47..382cbb4 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -24,14 +24,12 @@ function menu_test_menu() { 'type' => MENU_CALLBACK, 'access arguments' => array('access content'), ); - // This item uses system_admin_menu_block_page() to list child items. + // This item uses SystemController::systemAdminMenuBlockPage() to list child + // items. $items['menu_callback_description'] = array( 'title' => 'Menu item title', - 'page callback' => 'system_admin_menu_block_page', 'description' => 'Menu item description parent', - 'access arguments' => array('access content'), - 'file' => 'system.admin.inc', - 'file path' => drupal_get_path('module', 'system'), + 'route_name' => 'menu_callback_description', ); // This item tests the description key. $items['menu_callback_description/description-plain'] = array( @@ -296,14 +294,6 @@ function menu_test_menu() { 'access arguments' => array('access content'), ); - // File inheritance tests. This menu item should inherit the page callback - // system_admin_menu_block_page() and therefore render its children as links - // on the page. - $items['admin/config/development/file-inheritance'] = array( - 'title' => 'File inheritance', - 'description' => 'Test file inheritance', - 'access arguments' => array('access content'), - ); $items['admin/config/development/file-inheritance/inherit'] = array( 'title' => 'Inherit', 'description' => 'File inheritance test description', diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml index 3154626..9919ebc 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml +++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml @@ -1,3 +1,10 @@ +menu_callback_description: + pattern: 'menu_callback_description' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access content' + menu_router_test1: pattern: '/foo/{bar}' defaults: diff --git a/core/modules/user/user.module b/core/modules/user/user.module index eb6b4f3..85ff47f 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -944,15 +944,13 @@ function user_menu() { // Administration pages. $items['admin/config/people'] = array( - 'title' => 'People', - 'description' => 'Configure user accounts.', - 'position' => 'left', - 'weight' => -20, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', - 'file path' => drupal_get_path('module', 'system'), + 'title' => 'People', + 'description' => 'Configure user accounts.', + 'position' => 'left', + 'weight' => -20, + 'route_name' => 'user_admin_index', ); + $items['admin/config/people/accounts'] = array( 'title' => 'Account settings', 'description' => 'Configure default behavior of users, including registration requirements, e-mails, and fields.', diff --git a/core/modules/user/user.routing.yml b/core/modules/user/user.routing.yml index 10ec95d..2b2b5fc 100644 --- a/core/modules/user/user.routing.yml +++ b/core/modules/user/user.routing.yml @@ -26,6 +26,13 @@ user_autocomplete_anonymous: requirements: _permission: 'access user profiles' +user_admin_index: + pattern: '/admin/config/people' + defaults: + _form: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' + user_account_settings: pattern: '/admin/config/people/accounts' defaults: