You are here

class ContactStorageSettingsFormSave in Contact Storage 8

Invalidates the entity type definition cache when the settings are changed.

Hierarchy

Expanded class hierarchy of ContactStorageSettingsFormSave

1 string reference to 'ContactStorageSettingsFormSave'
contact_storage.services.yml in ./contact_storage.services.yml
contact_storage.services.yml
1 service uses ContactStorageSettingsFormSave
contact_storage.settings_form_save in ./contact_storage.services.yml
\Drupal\contact_storage\EventSubscriber\ContactStorageSettingsFormSave

File

src/EventSubscriber/ContactStorageSettingsFormSave.php, line 12

Namespace

Drupal\contact_storage\EventSubscriber
View 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

Namesort descending Modifiers Type Description Overrides
ContactStorageSettingsFormSave::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
ContactStorageSettingsFormSave::onSave public function Invalidates the entity type definition cache whenever settings are changed.