diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php new file mode 100644 index 0000000..276aa04 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Controller/SystemController.php @@ -0,0 +1,51 @@ + $content)); + } + else { + $output = t('You do not have any administrative items.'); + } + return $output; + } +} diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index a2b7926..ea858b3 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -68,28 +68,6 @@ 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; prints a listing of admin tasks, organized by module. */ function system_admin_index() { diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 3832720..953d805 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -650,11 +650,9 @@ function system_menu() { ); $items['admin'] = array( 'title' => 'Administration', - 'access arguments' => array('access administration pages'), - 'page callback' => 'system_admin_menu_block_page', + 'route_name' => 'system_admin', 'weight' => 9, 'menu_name' => 'admin', - 'file' => 'system.admin.inc', ); $items['admin/compact'] = array( 'title' => 'Compact mode', @@ -683,9 +681,7 @@ function system_menu() { 'description' => 'Administer blocks, content types, menus, etc.', 'position' => 'right', 'weight' => -8, - 'page callback' => 'system_admin_menu_block_page', - 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', + 'route_name' => 'system_admin_structure', ); // Appearance. $items['admin/appearance'] = array( @@ -786,9 +782,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_media', ); $items['admin/config/media/file-system'] = array( 'title' => 'File system', @@ -809,9 +803,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_services', ); $items['admin/config/services/rss-publishing'] = array( 'title' => 'RSS publishing', @@ -825,9 +817,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_development', ); $items['admin/config/development/maintenance'] = array( 'title' => 'Maintenance mode', @@ -854,9 +844,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_regional', ); $items['admin/config/regional/settings'] = array( 'title' => 'Regional settings', @@ -906,9 +894,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_search', ); // System settings. @@ -917,9 +903,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_system', ); $items['admin/config/system/site-information'] = array( 'title' => 'Site information', @@ -938,9 +922,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_ui', 'weight' => -15, ); $items['admin/config/workflow'] = array( @@ -948,29 +930,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_workflow', ); $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_content', ); // 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 61e203c..3e81881 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -1,3 +1,75 @@ +system_admin: + pattern: '/admin' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_structure: + pattern: '/admin/structure' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_reports: + pattern: '/admin/reports' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_media: + pattern: '/admin/config/media' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_services: + pattern: '/admin/config/services' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_development: + pattern: '/admin/config/development' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_regional: + pattern: '/admin/config/regional' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_search: + pattern: '/admin/config/search' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_system: + pattern: '/admin/config/system' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_ui: + pattern: '/admin/config/user-interface' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_workflow: + pattern: '/admin/config/workflow' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' +system_admin_config_content: + pattern: '/admin/config/content' + defaults: + _content: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' + requirements: + _permission: 'access administration pages' system.cron: pattern: '/cron/{key}' defaults: diff --git a/core/modules/system/tests/modules/design_test/design_test.module b/core/modules/system/tests/modules/design_test/design_test.module index a7ab1b5..d35e491 100644 --- a/core/modules/system/tests/modules/design_test/design_test.module +++ b/core/modules/system/tests/modules/design_test/design_test.module @@ -137,9 +137,9 @@ function design_test_menu_theme_callback() { /** * Menu page callback for a category listing page. * - * This is a specialized version of system_admin_menu_block_page(), which - * retrieves all direct child menu links of the current page, regardless of - * their type, skips default local tasks, and outputs them as a simple menu + * This is a specialized version of SystemController::systemAdminMenuBlockPage() + * , which retrieves all direct child menu links of the current page, regardless + * of their type, skips default local tasks, and outputs them as a simple menu * tree as the main page content. * * @param string $category 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 ce68fe9..6f304ef 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', ); $items['menu_callback_description/description-plain'] = array( 'title' => 'Menu item with a regular description', @@ -295,8 +293,8 @@ function menu_test_menu() { ); // 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. + // SystemController::systemAdminMenuBlockPage() and therefore render its + // children as links on the page. $items['admin/config/development/file-inheritance'] = array( 'title' => 'File inheritance', 'description' => 'Test file inheritance', 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 09b42ba..92e02e9 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 abfe84b..c4232de 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -976,15 +976,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_accounts', ); + $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 fb49de3..8d4b349 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_accounts: + 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: