function FileExampleSubmitHandlerHelper::handleShowSession

Utility submit function to show the contents of $_SESSION.

File

modules/file_example/src/FileExampleSubmitHandlerHelper.php, line 457

Class

FileExampleSubmitHandlerHelper
A submit handler helper class for the file_example module.

Namespace

Drupal\file_example

Code

public function handleShowSession(array &$form, FormStateInterface $form_state) {
    $dumper = $this->dumper();
    if ($dumper instanceof DevelDumperInterface) {
        // If the devel module is installed, use its nicer message format.
        $dumper->dump($this->sessionHelperWrapper
            ->getStoredData(), $this->t('Entire $_SESSION["file_example"]'));
    }
    else {
        $this->messenger
            ->addMessage(sprintf('<pre>%s</pre>', print_r($this->sessionHelperWrapper
            ->getStoredData(), TRUE)));
    }
}