class ContactStorageSettingsFormSave in Contact Storage 8
Invalidates the entity type definition cache when the settings are changed.
Hierarchy
- class \Drupal\contact_storage\EventSubscriber\ContactStorageSettingsFormSave implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ContactStorageSettingsFormSave
1 string reference to 'ContactStorageSettingsFormSave'
1 service uses ContactStorageSettingsFormSave
File
- src/
EventSubscriber/ ContactStorageSettingsFormSave.php, line 12
Namespace
Drupal\contact_storage\EventSubscriberView source
class ContactStorageSettingsFormSave implements EventSubscriberInterface {
/**
* Invalidates the entity type definition cache whenever settings are changed.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The Event to process.
*/
public function onSave(ConfigCrudEvent $event) {
if ($event
->getConfig()
->getName() === 'contact_storage.settings') {
\Drupal::entityTypeManager()
->clearCachedDefinitions();
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = [
'onSave',
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContactStorageSettingsFormSave:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ContactStorageSettingsFormSave:: |
public | function | Invalidates the entity type definition cache whenever settings are changed. |