isChanged example

    if ($config_name === 'system.site') {
      $this->cacheTagsInvalidator->invalidateTags(['route_match', 'rendered']);
    }

    // Theme configuration and global theme settings.     if (in_array($config_name['system.theme', 'system.theme.global'], TRUE)) {
      $this->cacheTagsInvalidator->invalidateTags(['rendered']);
    }

    // Library and template overrides potentially change for the default theme     // when the admin theme is changed.     if ($config_name === 'system.theme' && $event->isChanged('admin')) {
      $this->cacheTagsInvalidator->invalidateTags(['library_info', 'theme_registry']);
    }

    // Theme-specific settings, check if this matches a theme settings     // configuration object (THEME_NAME.settings), in that case, clear the     // rendered cache tag.     if (preg_match('/^([^\.]*)\.settings$/', $config_name$matches)) {
      if ($this->themeHandler->themeExists($matches[1])) {
        $this->cacheTagsInvalidator->invalidateTags(['rendered']);
      }
    }
  }
/** * Invalidates cache tags when particular system config objects are saved. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The Event to process. */
  public function onSave(ConfigCrudEvent $event) {
    $config_name = $event->getConfig()->getName();

    // Ckeditor5-stylesheets settings may change when the default theme changes.     if ($config_name === 'system.theme' && $event->isChanged('default')) {
      // @see ckeditor5_library_info_alter()       $this->cacheTagsInvalidator->invalidateTags(['library_info']);
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents() {
    $events[ConfigEvents::SAVE][] = ['onSave'];
    return $events;
  }
$this->routerBuilder = $router_builder;
  }

  /** * Rebuilds the router when the default or admin theme is changed. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The configuration event. */
  public function onConfigSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() == 'system.theme' && ($event->isChanged('admin') || $event->isChanged('default'))) {
      $this->routerBuilder->setRebuildNeeded();
    }
  }

  /** * Checks that the configuration synchronization is valid. * * This event listener prevents deleting all configuration. If there is * nothing to import then event propagation is stopped because there is no * config import to validate. * * @param \Drupal\Core\Config\ConfigImporterEvent $event * The config import event. */
public function alterRoutes(RouteCollection $collection) {
    if ($this->configFactory->get('system.feature_flags')->get('linkset_endpoint')) {
      $collection->get('system.menu.linkset')->setOption('_auth', $this->providerIds);
    }
  }

  /** * {@inheritdoc} */
  public function onConfigSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() === 'system.feature_flags' && $event->isChanged('linkset_endpoint')) {
      $this->routeBuilder->setRebuildNeeded();
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    $events = parent::getSubscribedEvents();
    // Run after the route alter event subscriber.     $events[ConfigEvents::SAVE][] = ['onConfigSave', 0];
    

    }
  }

  /** * Rebuilds the router when node.settings:use_admin_theme is changed. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The event object. */
  public function onConfigSave(ConfigCrudEvent $event) {
    if ($event->getConfig()->getName() === 'node.settings' && $event->isChanged('use_admin_theme')) {
      $this->routerBuilder->setRebuildNeeded();
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    $events = parent::getSubscribedEvents();
    $events[ConfigEvents::SAVE][] = ['onConfigSave', 0];
    return $events;
  }

  }

  /** * Updates the default time zone when time zone config changes. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The config crud event. */
  public function onConfigSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() === 'system.date' && ($event->isChanged('timezone.default') || $event->isChanged('timezone.user.configurable'))) {
      $this->setDefaultTimeZone();
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    $events[ConfigEvents::SAVE][] = ['onConfigSave', 0];
    // The priority for this must run directly after the authentication     // subscriber.
/** * Deletes the stored response from the security advisories feed, if needed. * * The stored response will only be deleted if the 'interval_hours' config * setting is reduced from the previous value. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The configuration event. */
  public function onConfigSave(ConfigCrudEvent $event): void {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() === 'system.advisories' && $event->isChanged('interval_hours')) {
      $original_interval = $saved_config->getOriginal('interval_hours');
      if ($original_interval && $saved_config->get('interval_hours') < $original_interval) {
        // If the new interval is less than the original interval, delete the         // stored results.         $this->securityAdvisoriesFetcher->deleteStoredResponse();
      }
    }
  }

  /** * {@inheritdoc} */

  public function onConfigSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() == 'system.site' && $event->isChanged('default_langcode')) {
      $new_default_langcode = $saved_config->get('default_langcode');
      $default_language = $this->configFactory->get('language.entity.' . $new_default_langcode);
      // During an import the language might not exist yet.       if (!$default_language->isNew()) {
        $this->languageDefault->set(new Language($default_language->get()));
        $this->languageManager->reset();

        // Directly update language negotiation settings instead of calling         // language_negotiation_url_prefixes_update() to ensure that the code         // obeys the hook_update_N() restrictions.         $negotiation_config = $this->configFactory->getEditable('language.negotiation');
        
$this->entityTypeManager = $entity_type_manager;
  }

  /** * Updates entity type definitions and ensures routes are rebuilt when needed. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The ConfigCrudEvent to process. */
  public function onSave(ConfigCrudEvent $event) {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() === 'media.settings' && $event->isChanged('standalone_url')) {
      $this->cacheTagsInvalidator->invalidateTags([
        // The configuration change triggers entity type definition changes,         // which in turn triggers routes to appear or disappear.         // @see media_entity_type_alter()         'entity_types',
        // The 'rendered' cache tag needs to be explicitly invalidated to ensure         // that all links to Media entities are re-rendered. Ideally, this would         // not be necessary; invalidating the 'entity_types' cache tag should be         // sufficient. But that cache tag would then need to be on nearly         // everything, resulting in excessive complexity. We prefer pragmatism.         'rendered',
      ]);

  }

  /** * Invalidates 4xx-response cache tag if fast 404 config is changed. * * @param \Drupal\Core\Config\ConfigCrudEvent $event * The configuration event. */
  public function onConfigSave(ConfigCrudEvent $event): void {
    $saved_config = $event->getConfig();
    if ($saved_config->getName() === 'system.performance' && $event->isChanged('fast_404')) {
      $this->cacheTagsInvalidator->invalidateTags(['4xx-response']);
    }
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    $events = parent::getSubscribedEvents();
    $events[ConfigEvents::SAVE] = 'onConfigSave';
    return $events;
  }
Home | Imprint | This part of the site doesn't use cookies.