You are here

public function CaptchaCachedSettingsSubscriber::onSave in CAPTCHA 8

Clearing the cached definitions whenever the settings are modified.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.

File

src/EventSubscriber/CaptchaCachedSettingsSubscriber.php, line 38

Class

CaptchaCachedSettingsSubscriber
A subscriber clearing the cached definitions when saving captcha settings.

Namespace

Drupal\captcha\EventSubscriber

Code

public function onSave(ConfigCrudEvent $event) {

  // Changing the Captcha settings means that any page might result in other
  // settings for captcha so the cached definitions need to be cleared.
  if ($event
    ->getConfig()
    ->getName() === 'captcha.settings') {
    $this->elementInfo
      ->clearCachedDefinitions();
  }
}