function FileExampleSubmitHandlerHelper::handleResetSession

Utility submit function to reset the demo.

@todo Note this does NOT clear any managed file references in Drupal's DB. It might be a good idea to add this. https://www.drupal.org/project/examples/issues/2985471

Parameters

array $form: FormAPI form.

\Drupal\Core\Form\FormStateInterface $form_state: FormAPI form state.

File

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

Class

FileExampleSubmitHandlerHelper
A submit handler helper class for the file_example module.

Namespace

Drupal\file_example

Code

public function handleResetSession(array &$form, FormStateInterface $form_state) {
    $this->stateHelper
        ->deleteDefaultState();
    $this->sessionHelperWrapper
        ->clearStoredData();
    $this->messenger
        ->addMessage('Session reset.');
}