You are here

protected function SessionExampleForm::invalidateCacheTag in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 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(),
  ]);
}