function SystemController::compactPage

Same name and namespace in other branches
  1. 11.x core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
  2. 10 core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
  3. 9 core/modules/system/src/Controller/SystemController.php \Drupal\system\Controller\SystemController::compactPage()
  4. 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.

Parameters

string $mode: Valid values are 'on' and 'off'.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A redirect response to the front page.

1 string reference to 'SystemController::compactPage'
system.routing.yml in core/modules/system/system.routing.yml
core/modules/system/system.routing.yml

File

core/modules/system/src/Controller/SystemController.php, line 120

Class

SystemController
Returns responses for System routes.

Namespace

Drupal\system\Controller

Code

public function compactPage($mode) {
  $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.