当前位置: 首页>>代码示例>>PHP>>正文


PHP TypedConfigManagerInterface::clearCachedDefinitions方法代码示例

本文整理汇总了PHP中Drupal\Core\Config\TypedConfigManagerInterface::clearCachedDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP TypedConfigManagerInterface::clearCachedDefinitions方法的具体用法?PHP TypedConfigManagerInterface::clearCachedDefinitions怎么用?PHP TypedConfigManagerInterface::clearCachedDefinitions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Config\TypedConfigManagerInterface的用法示例。


在下文中一共展示了TypedConfigManagerInterface::clearCachedDefinitions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: installDefaultConfig

 /**
  * {@inheritdoc}
  */
 public function installDefaultConfig($type, $name)
 {
     $extension_path = $this->drupalGetPath($type, $name);
     // Refresh the schema cache if the extension provides configuration schema
     // or is a theme.
     if (is_dir($extension_path . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY) || $type == 'theme') {
         $this->typedConfig->clearCachedDefinitions();
     }
     $default_install_path = $this->getDefaultConfigDirectory($type, $name);
     if (is_dir($default_install_path)) {
         if (!$this->isSyncing()) {
             $storage = new FileStorage($default_install_path, StorageInterface::DEFAULT_COLLECTION);
             $prefix = '';
         } else {
             // The configuration importer sets the source storage on the config
             // installer. The configuration importer handles all of the
             // configuration entity imports. We only need to ensure that simple
             // configuration is created when the extension is installed.
             $storage = $this->getSourceStorage();
             $prefix = $name . '.';
         }
         // Gets profile storages to search for overrides if necessary.
         $profile_storages = $this->getProfileStorages($name);
         // Gather information about all the supported collections.
         $collection_info = $this->configManager->getConfigCollectionInfo();
         foreach ($collection_info->getCollectionNames() as $collection) {
             $config_to_create = $this->getConfigToCreate($storage, $collection, $prefix, $profile_storages);
             // If we're installing a profile ensure configuration that is overriding
             // is excluded.
             if ($name == $this->drupalGetProfile()) {
                 $existing_configuration = $this->getActiveStorages($collection)->listAll();
                 $config_to_create = array_diff_key($config_to_create, array_flip($existing_configuration));
             }
             if (!empty($config_to_create)) {
                 $this->createConfiguration($collection, $config_to_create);
             }
         }
     }
     // During a drupal installation optional configuration is installed at the
     // end of the installation process.
     // @see install_install_profile()
     if (!$this->isSyncing() && !$this->drupalInstallationAttempted()) {
         $optional_install_path = $extension_path . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
         if (is_dir($optional_install_path)) {
             // Install any optional config the module provides.
             $storage = new FileStorage($optional_install_path, StorageInterface::DEFAULT_COLLECTION);
             $this->installOptionalConfig($storage, '');
         }
         // Install any optional configuration entities whose dependencies can now
         // be met. This searches all the installed modules config/optional
         // directories.
         $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE);
         $this->installOptionalConfig($storage, [$type => $name]);
     }
     // Reset all the static caches and list caches.
     $this->configFactory->reset();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:60,代码来源:ConfigInstaller.php

示例2: uninstall

 /**
  * {@inheritdoc}
  */
 public function uninstall($type, $name)
 {
     // Remove all dependent configuration entities.
     $dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
     // Reverse the array to that entities are removed in the correct order of
     // dependence. For example, this ensures that field instances are removed
     // before fields.
     foreach (array_reverse($dependent_entities) as $entity) {
         $entity->setUninstalling(TRUE);
         $entity->delete();
     }
     $config_names = $this->configFactory->listAll($name . '.');
     foreach ($config_names as $config_name) {
         $this->configFactory->get($config_name)->delete();
     }
     // Remove any matching configuration from collections.
     foreach ($this->activeStorage->getAllCollectionNames() as $collection) {
         $collection_storage = $this->activeStorage->createCollection($collection);
         $collection_storage->deleteAll($name . '.');
     }
     $schema_dir = drupal_get_path($type, $name) . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY;
     if (is_dir($schema_dir)) {
         // Refresh the schema cache if uninstalling an extension that provides
         // configuration schema.
         $this->typedConfigManager->clearCachedDefinitions();
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:30,代码来源:ConfigManager.php

示例3: uninstall

 /**
  * {@inheritdoc}
  */
 public function uninstall($type, $name)
 {
     $entities = $this->getConfigEntitiesToChangeOnDependencyRemoval($type, [$name], FALSE);
     // Fix all dependent configuration entities.
     /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
     foreach ($entities['update'] as $entity) {
         $entity->save();
     }
     // Remove all dependent configuration entities.
     foreach ($entities['delete'] as $entity) {
         $entity->setUninstalling(TRUE);
         $entity->delete();
     }
     $config_names = $this->configFactory->listAll($name . '.');
     foreach ($config_names as $config_name) {
         $this->configFactory->getEditable($config_name)->delete();
     }
     // Remove any matching configuration from collections.
     foreach ($this->activeStorage->getAllCollectionNames() as $collection) {
         $collection_storage = $this->activeStorage->createCollection($collection);
         $collection_storage->deleteAll($name . '.');
     }
     $schema_dir = drupal_get_path($type, $name) . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY;
     if (is_dir($schema_dir)) {
         // Refresh the schema cache if uninstalling an extension that provides
         // configuration schema.
         $this->typedConfigManager->clearCachedDefinitions();
     }
 }
开发者ID:frankcr,项目名称:sftw8,代码行数:32,代码来源:ConfigManager.php

示例4: installDefaultConfig

 /**
  * {@inheritdoc}
  */
 public function installDefaultConfig($type, $name)
 {
     $extension_path = drupal_get_path($type, $name);
     // If the extension provides configuration schema clear the definitions.
     if (is_dir($extension_path . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY)) {
         // Refresh the schema cache if installing default configuration and the
         // extension has a configuration schema directory.
         $this->typedConfig->clearCachedDefinitions();
     }
     // Gather information about all the supported collections.
     $collection_info = $this->configManager->getConfigCollectionInfo();
     $old_state = $this->configFactory->getOverrideState();
     $this->configFactory->setOverrideState(FALSE);
     // Read enabled extensions directly from configuration to avoid circular
     // dependencies with ModuleHandler and ThemeHandler.
     $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'));
     // Core can provide configuration.
     $enabled_extensions[] = 'core';
     foreach ($collection_info->getCollectionNames(TRUE) as $collection) {
         $config_to_install = $this->listDefaultConfigCollection($collection, $type, $name, $enabled_extensions);
         if (!empty($config_to_install)) {
             $this->createConfiguration($collection, $config_to_install);
         }
     }
     $this->configFactory->setOverrideState($old_state);
     // Reset all the static caches and list caches.
     $this->configFactory->reset();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:33,代码来源:ConfigInstaller.php

示例5: uninstall

 /**
  * {@inheritdoc}
  */
 public function uninstall($type, $name)
 {
     // Remove all dependent configuration entities.
     $extension_dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
     // Give config entities a chance to become independent of the entities we
     // are going to delete.
     foreach ($extension_dependent_entities as $entity) {
         $entity_dependencies = $entity->getDependencies();
         if (empty($entity_dependencies)) {
             // No dependent entities nothing to do.
             continue;
         }
         // Work out if any of the entity's dependencies are going to be affected
         // by the uninstall.
         $affected_dependencies = array('entity' => array(), 'module' => array(), 'theme' => array());
         if (isset($entity_dependencies['entity'])) {
             foreach ($extension_dependent_entities as $extension_dependent_entity) {
                 if (in_array($extension_dependent_entity->getConfigDependencyName(), $entity_dependencies['entity'])) {
                     $affected_dependencies['entity'][] = $extension_dependent_entity;
                 }
             }
         }
         // Check if the extension being uninstalled is a dependency of the entity.
         if (isset($entity_dependencies[$type]) && in_array($name, $entity_dependencies[$type])) {
             $affected_dependencies[$type] = array($name);
         }
         // Inform the entity.
         $entity->onDependencyRemoval($affected_dependencies);
     }
     // Recalculate the dependencies, some config entities may have fixed their
     // dependencies on the to-be-removed entities.
     $extension_dependent_entities = $this->findConfigEntityDependentsAsEntities($type, array($name));
     // Reverse the array to that entities are removed in the correct order of
     // dependence. For example, this ensures that fields are removed before
     // field storages.
     foreach (array_reverse($extension_dependent_entities) as $extension_dependent_entity) {
         $extension_dependent_entity->setUninstalling(TRUE);
         $extension_dependent_entity->delete();
     }
     $config_names = $this->configFactory->listAll($name . '.');
     foreach ($config_names as $config_name) {
         $this->configFactory->get($config_name)->delete();
     }
     // Remove any matching configuration from collections.
     foreach ($this->activeStorage->getAllCollectionNames() as $collection) {
         $collection_storage = $this->activeStorage->createCollection($collection);
         $collection_storage->deleteAll($name . '.');
     }
     $schema_dir = drupal_get_path($type, $name) . '/' . InstallStorage::CONFIG_SCHEMA_DIRECTORY;
     if (is_dir($schema_dir)) {
         // Refresh the schema cache if uninstalling an extension that provides
         // configuration schema.
         $this->typedConfigManager->clearCachedDefinitions();
     }
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:58,代码来源:ConfigManager.php


注:本文中的Drupal\Core\Config\TypedConfigManagerInterface::clearCachedDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。