You are here

public function ConfigEventsSubscriber::configSave in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()
  2. 8.7 modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()
  3. 10.3.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()
  4. 10.0.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()
  5. 10.1.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()
  6. 10.2.x modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php \Drupal\social_profile_privacy\EventSubscriber\ConfigEventsSubscriber::configSave()

React to a config object being saved.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: Config crud event.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Drupal\search_api\SearchApiException

File

modules/social_features/social_profile/modules/social_profile_privacy/src/EventSubscriber/ConfigEventsSubscriber.php, line 79

Class

ConfigEventsSubscriber
Class ConfigEventSubscriber.

Namespace

Drupal\social_profile_privacy\EventSubscriber

Code

public function configSave(ConfigCrudEvent $event) {

  // A list of configuration changes that trigger an index update.
  $triggers = [
    'social_profile_privacy.settings' => 'limit_search_and_mention',
    'social_profile_fields.settings' => 'profile_profile_field_profile_nick_name',
  ];

  // If the config that changed is part of our trigger list and the value that
  // changed is one we're interested in, perform the re-index.
  $config_name = $event
    ->getConfig()
    ->getName();
  if (isset($triggers[$config_name]) && $event
    ->isChanged($triggers[$config_name])) {
    $this
      ->invalidateSearchIndices();
  }
}