diff --git a/core/modules/block/lib/Drupal/block/Controller/BlockAutocompleteController.php b/core/modules/block/lib/Drupal/block/Controller/BlockAutocompleteController.php index 539a8c1..173b051 100644 --- a/core/modules/block/lib/Drupal/block/Controller/BlockAutocompleteController.php +++ b/core/modules/block/lib/Drupal/block/Controller/BlockAutocompleteController.php @@ -75,4 +75,18 @@ public function autocomplete(Request $request) { return new JsonResponse($matches); } + /** + * Sets whether the admin menu is in compact mode or not. + * + * @param string $mode + * Valid values are 'on' and 'off'. + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + * A redirect response. Redirects back to the front page. + */ + public function compactPage($mode) { + user_cookie_save(array('admin_compact_mode' => ($mode == 'on'))); + return new RedirectResponse(url('', array('absolute' => TRUE))); + } + } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 1935f5c..870ad56 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -631,13 +631,6 @@ function system_menu() { 'menu_name' => 'admin', 'file' => 'system.admin.inc', ); - $items['admin/compact'] = array( - 'title' => 'Compact mode', - 'page callback' => 'system_admin_compact_page', - 'access arguments' => array('access administration pages'), - 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', - ); $items['admin/tasks'] = array( 'title' => 'Tasks', 'type' => MENU_DEFAULT_LOCAL_TASK, @@ -2995,14 +2988,14 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, * such as the configuration page and the permissions page. * * Whether the user is in compact mode is determined by a cookie, which is set - * for the user by system_admin_compact_page(). + * for the user by \Drupal\system\Controller\SystemController::compactPage(). * * If the user does not have the cookie, the default value is given by the * system variable 'admin_compact_mode', which itself defaults to FALSE. This * does not have a user interface to set it: it is a hidden variable which can * be set in the settings.php file. * - * @return + * @return bool * TRUE when in compact mode, FALSE when in expanded mode. */ function system_admin_compact_mode() { @@ -3012,17 +3005,6 @@ function system_admin_compact_mode() { } /** - * Menu callback; Sets whether the admin menu is in compact mode or not. - * - * @param $mode - * Valid values are 'on' and 'off'. - */ -function system_admin_compact_page($mode = 'off') { - user_cookie_save(array('admin_compact_mode' => ($mode == 'on'))); - return new RedirectResponse(url('', array('absolute' => TRUE))); -} - -/** * Generate a list of tasks offered by a specified module. * * @param $module diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 017d486..254bf01 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -10,6 +10,15 @@ system.cron: _controller: '\Drupal\system\CronController::run' requirements: _access_system_cron: 'TRUE' + +system_admin_compact_page: + pattern: '/admin/compact/{mode}' + defaults: + _controller: 'Drupal\system\Controller\SystemController::compactPage' + mode: 'off' + requirements: + _permission: 'access administration pages' + system.machine_name_transliterate: pattern: '/machine_name/transliterate' defaults: