You are here

public function DevelController::session in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Controller/DevelController.php \Drupal\devel\Controller\DevelController::session()
  2. 8.2 src/Controller/DevelController.php \Drupal\devel\Controller\DevelController::session()
  3. 4.x src/Controller/DevelController.php \Drupal\devel\Controller\DevelController::session()

Builds the session overview page.

Return value

array Array of page elements to render.

1 string reference to 'DevelController::session'
devel.routing.yml in ./devel.routing.yml
devel.routing.yml

File

src/Controller/DevelController.php, line 174

Class

DevelController
Returns responses for devel module routes.

Namespace

Drupal\devel\Controller

Code

public function session() {
  $output['description'] = array(
    '#markup' => '<p>' . $this
      ->t('Here are the contents of your $_SESSION variable.') . '</p>',
  );
  $output['session'] = array(
    '#type' => 'table',
    '#header' => array(
      $this
        ->t('Session name'),
      $this
        ->t('Session ID'),
    ),
    '#rows' => array(
      array(
        session_name(),
        session_id(),
      ),
    ),
    '#empty' => $this
      ->t('No session available.'),
  );
  $output['data'] = $this->dumper
    ->exportAsRenderable($_SESSION);
  return $output;
}