filterOverride example



  /** * {@inheritdoc} */
  public function onConfigSave(ConfigCrudEvent $event) {
    $config = $event->getConfig();
    $name = $config->getName();
    foreach (\Drupal::languageManager()->getLanguages() as $language) {
      $config_translation = $this->getOverride($language->getId()$name);
      if (!$config_translation->isNew()) {
        $this->filterOverride($config$config_translation);
      }
    }
  }

  /** * {@inheritdoc} */
  public function onConfigRename(ConfigRenameEvent $event) {
    $config = $event->getConfig();
    $name = $config->getName();
    $old_name = $event->getOldName();
    
$active_langcode = $this->getActiveConfigLangcode($name);
      $active = $this->configStorage->read($name);

      foreach ($langcodes as $langcode) {
        $processed = $this->processTranslatableData($name$active$translatable$langcode);
        // If the language code is not the same as the active storage         // language, we should update the configuration override.         if ($langcode != $active_langcode) {
          $override = $this->languageManager->getLanguageConfigOverride($langcode$name);
          // Filter out locale managed configuration keys so that translations           // removed from Locale will be reflected in the config override.           $data = $this->filterOverride($override->get()$translatable);
          if (!empty($processed)) {
            // Merge in the Locale managed translations with existing data.             $data = NestedArray::mergeDeepArray([$data$processed], TRUE);
          }
          if (empty($data) && !$override->isNew()) {
            // The configuration override contains Locale overrides that no             // longer exist.             $this->deleteTranslationOverride($name$langcode);
            $count++;
          }
          elseif (!empty($data)) {
            
Home | Imprint | This part of the site doesn't use cookies.