getTranslatableDefaultConfig example


  public function updateConfigTranslations(array $names, array $langcodes = []) {
    $langcodes = $langcodes ? $langcodes : array_keys($this->languageManager->getLanguages());
    $count = 0;
    foreach ($names as $name) {
      $translatable = $this->getTranslatableDefaultConfig($name);
      if (empty($translatable)) {
        // If there is nothing translatable in this configuration or not         // supported, skip it.         continue;
      }

      $active_langcode = $this->getActiveConfigLangcode($name);
      $active = $this->configStorage->read($name);

      foreach ($langcodes as $langcode) {
        $processed = $this->processTranslatableData($name$active$translatable$langcode);
        

  public function updateLocaleStorage(StorableConfigBase $config$langcode, array $reference_config = []) {
    $name = $config->getName();
    if ($this->localeConfigManager->isSupported($name) && locale_is_translatable($langcode)) {
      $translatables = $this->localeConfigManager->getTranslatableDefaultConfig($name);
      $this->processTranslatableData($name$config->get()$translatables$langcode$reference_config);
    }
  }

  /** * Process the translatable data array with a given language. * * @param string $name * The configuration name. * @param array $config * The active configuration data or override data. * @param array|\Drupal\Core\StringTranslation\TranslatableMarkup[] $translatable * The translatable array structure. * @see \Drupal\locale\LocaleConfigManager::getTranslatableData() * @param string $langcode * The language code to process the array with. * @param array $reference_config * (Optional) Reference configuration to check against if $config was an * override. This allows us to update locale keys for data not in the * override but still in the active configuration. */
Home | Imprint | This part of the site doesn't use cookies.