function SystemController::compactPage
Same name and namespace in other branches
- 11.x core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
- 10 core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
- 9 core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
- 8.9.x core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
Sets whether the admin menu is in compact mode or not.
Attributes
#[Route(path: '/admin/compact/{mode}', name: 'system.admin_compact_page', requirements: [
'_permission' => 'access administration pages',
], defaults: [
'mode' => 'off',
])]
Parameters
string $mode: Valid values are 'on' and 'off'.
Return value
\Symfony\Component\HttpFoundation\RedirectResponse A redirect response to the front page.
Deprecated
in drupal:11.5.0 and is removed from drupal:12.0.0. There is no replacement.
See also
https://www.drupal.org/node/3588109
File
-
core/
modules/ system/ src/ Controller/ SystemController.php, line 136
Class
- SystemController
- Returns responses for System routes.
Namespace
Drupal\system\ControllerCode
public function compactPage($mode) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:11.5.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3588109', E_USER_DEPRECATED);
$response = $this->redirect('<front>');
if ($mode === 'on') {
$response->headers
->setCookie(new Cookie('Drupal.visitor.admin_compact_mode', '1', $this->time
->getRequestTime() + 31536000));
}
else {
$response->headers
->clearCookie('Drupal.visitor.admin_compact_mode');
}
return $response;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.