function SessionExampleForm::invalidateCacheTag

Same name in other branches
  1. 8.x-1.x session_example/src/Form/SessionExampleForm.php \Drupal\session_example\Form\SessionExampleForm::invalidateCacheTag()
  2. 4.0.x modules/session_example/src/Form/SessionExampleForm.php \Drupal\session_example\Form\SessionExampleForm::invalidateCacheTag()

Invalidate the cache tag for this session.

The form will use this method to invalidate the cache tag when the user updates their information in the submit handlers.

2 calls to SessionExampleForm::invalidateCacheTag()
SessionExampleForm::submitClearSession in modules/session_example/src/Form/SessionExampleForm.php
Remove all the session information.
SessionExampleForm::submitForm in modules/session_example/src/Form/SessionExampleForm.php
Form submission handler.

File

modules/session_example/src/Form/SessionExampleForm.php, line 192

Class

SessionExampleForm
Form to allow the user to store information in their session.

Namespace

Drupal\session_example\Form

Code

protected function invalidateCacheTag() {
    $this->cacheTagInvalidator
        ->invalidateTags([
        'session_example:' . $this->session
            ->getId(),
    ]);
}