コード例 #1
0
 /**
  * Deletes translation data from locale module.
  *
  * This will invoke LocaleConfigSubscriber through the event dispatcher. To
  * make sure the configuration was persisted correctly, the configuration
  * value is checked. Because LocaleConfigSubscriber temporarily disables the
  * override state of the configuration factory we check that the correct value
  * is restored afterwards.
  *
  * @param string $config_name
  *   The configuration name.
  * @param string $key
  *   The configuration key.
  * @param string $source_value
  *   The source configuration value to verify the correct value is returned
  *   from the configuration factory after the deletion.
  * @param string $langcode
  *   The language code.
  */
 protected function deleteLocaleTranslationData($config_name, $key, $source_value, $langcode)
 {
     $this->localeConfigManager->getStringTranslation($config_name, $langcode, $source_value, '')->delete();
     $this->localeConfigManager->reset();
     $this->localeConfigManager->updateConfigTranslations(array($config_name), array($langcode));
     $this->configFactory->reset($config_name);
     $this->assertNoConfigOverride($config_name, $key, $source_value, $langcode);
 }
コード例 #2
0
ファイル: ConfigInstaller.php プロジェクト: dmyerson/d8ecs
 /**
  * {@inheritdoc}
  */
 public function installCollectionDefaultConfig($collection)
 {
     $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, $this->drupalInstallationAttempted());
     // Only install configuration for enabled extensions.
     $enabled_extensions = $this->getEnabledExtensions();
     $config_to_install = array_filter($storage->listAll(), function ($config_name) use($enabled_extensions) {
         $provider = Unicode::substr($config_name, 0, strpos($config_name, '.'));
         return in_array($provider, $enabled_extensions);
     });
     if (!empty($config_to_install)) {
         $this->createConfiguration($collection, $storage->readMultiple($config_to_install));
         // Reset all the static caches and list caches.
         $this->configFactory->reset();
     }
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function installCollectionDefaultConfig($collection)
 {
     $config_to_install = $this->getSourceStorage($collection)->listAll();
     $extension_config = $this->configFactory->get('core.extension');
     $enabled_extensions = array_keys((array) $extension_config->get('module'));
     $enabled_extensions += array_keys((array) $extension_config->get('theme'));
     $config_to_install = array_filter($config_to_install, function ($config_name) use($enabled_extensions) {
         $provider = Unicode::substr($config_name, 0, strpos($config_name, '.'));
         return in_array($provider, $enabled_extensions);
     });
     if (!empty($config_to_install)) {
         $old_state = $this->configFactory->getOverrideState();
         $this->configFactory->setOverrideState(FALSE);
         $this->createConfiguration($collection, $config_to_install);
         $this->configFactory->setOverrideState($old_state);
         // Reset all the static caches and list caches.
         $this->configFactory->reset();
     }
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function reload()
 {
     $this->config = NULL;
     $this->configFactory->reset($this->configName);
 }
コード例 #5
0
 /**
  * Deletes translation data from locale module.
  *
  * This will invoke LocaleConfigSubscriber through the event dispatcher. To
  * make sure the configuration was persisted correctly, the configuration
  * value is checked. Because LocaleConfigSubscriber temporarily disables the
  * override state of the configuration factory we check that the correct value
  * is restored afterwards.
  *
  * @param string $config_name
  *   The configuration name.
  * @param string $key
  *   The configuration key.
  * @param string $source_value
  *   The source configuration value to verify the correct value is returned
  *   from the configuration factory after the deletion.
  */
 protected function deleteLocaleTranslationData($config_name, $key, $source_value)
 {
     $this->localeConfigManager->deleteTranslationData($config_name, $this->langcode);
     $this->configFactory->reset($config_name);
     $this->assertConfigValue($config_name, $key, $source_value);
 }