function DevelController::session

Same name in other branches
  1. 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 193

Class

DevelController
Returns responses for devel module routes.

Namespace

Drupal\devel\Controller

Code

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