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


PHP StorageInterface::listAll方法代码示例

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


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

示例1: getConfigNames

 protected function getConfigNames($config_type)
 {
     $this->configStorage = $this->getDrupalService('config.storage');
     // For a given entity type, load all entities.
     if ($config_type && $config_type !== 'system.simple') {
         $entity_storage = $this->entityManager->getStorage($config_type);
         foreach ($entity_storage->loadMultiple() as $entity) {
             $entity_id = $entity->id();
             $label = $entity->label() ?: $entity_id;
             $names[$entity_id] = $label;
         }
     } else {
         // Gather the config entity prefixes.
         $config_prefixes = array_map(function ($definition) {
             return $definition->getConfigPrefix() . '.';
         }, $this->definitions);
         // Find all config, and then filter our anything matching a config prefix.
         $names = $this->configStorage->listAll();
         $names = array_combine($names, $names);
         foreach ($names as $config_name) {
             foreach ($config_prefixes as $config_prefix) {
                 if (strpos($config_name, $config_prefix) === 0) {
                     unset($names[$config_name]);
                 }
             }
         }
     }
     return $names;
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:29,代码来源:ExportSingleCommand.php

示例2: getDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $definitions = array();
     foreach ($this->schemaStorage->readMultiple($this->schemaStorage->listAll()) as $schema) {
         foreach ($schema as $type => $definition) {
             $definitions[$type] = $definition;
         }
     }
     return $definitions;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:13,代码来源:ConfigSchemaDiscovery.php

示例3: listConfigByType

 /**
  * {@inheritdoc}
  */
 public function listConfigByType($config_type)
 {
     // For a given entity type, load all entities.
     if ($config_type && $config_type !== FeaturesManagerInterface::SYSTEM_SIMPLE_CONFIG) {
         $entity_storage = $this->entityManager->getStorage($config_type);
         $names = [];
         foreach ($entity_storage->loadMultiple() as $entity) {
             $entity_id = $entity->id();
             $label = $entity->label() ?: $entity_id;
             $names[$entity_id] = $label;
         }
     } else {
         $definitions = [];
         foreach ($this->entityManager->getDefinitions() as $entity_type => $definition) {
             if ($definition->isSubclassOf('Drupal\\Core\\Config\\Entity\\ConfigEntityInterface')) {
                 $definitions[$entity_type] = $definition;
             }
         }
         // Gather the config entity prefixes.
         $config_prefixes = array_map(function (EntityTypeInterface $definition) {
             return $definition->getConfigPrefix() . '.';
         }, $definitions);
         // Find all config, and then filter our anything matching a config prefix.
         $names = $this->configStorage->listAll();
         $names = array_combine($names, $names);
         foreach ($names as $item_name) {
             foreach ($config_prefixes as $config_prefix) {
                 if (strpos($item_name, $config_prefix) === 0) {
                     unset($names[$item_name]);
                 }
             }
         }
     }
     return $names;
 }
开发者ID:atif-shaikh,项目名称:DCX-Profile,代码行数:38,代码来源:FeaturesManager.php

示例4: testInvalidStorage

 /**
  * Tests an invalid storage.
  */
 public function testInvalidStorage()
 {
     $name = 'config_test.storage';
     // Write something to the valid storage to prove that the storages do not
     // pollute one another.
     $data = array('foo' => 'bar');
     $result = $this->storage->write($name, $data);
     $this->assertIdentical($result, TRUE);
     $raw_data = $this->read($name);
     $this->assertIdentical($raw_data, $data);
     // Reading from a non-existing storage bin returns FALSE.
     $result = $this->invalidStorage->read($name);
     $this->assertIdentical($result, FALSE);
     // Deleting from a non-existing storage bin throws an exception.
     try {
         $this->invalidStorage->delete($name);
         $this->fail('Exception not thrown upon deleting from a non-existing storage bin.');
     } catch (\Exception $e) {
         $class = get_class($e);
         $this->pass($class . ' thrown upon deleting from a non-existing storage bin.');
     }
     // Listing on a non-existing storage bin returns an empty array.
     $result = $this->invalidStorage->listAll();
     $this->assertIdentical($result, array());
     // Writing to a non-existing storage bin creates the bin.
     $this->invalidStorage->write($name, array('foo' => 'bar'));
     $result = $this->invalidStorage->read($name);
     $this->assertIdentical($result, array('foo' => 'bar'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:32,代码来源:ConfigStorageTestBase.php

示例5: findConfiguration

 /**
  * Handles switching the configuration type selector.
  */
 protected function findConfiguration($config_type)
 {
     $names = array('' => $this->t('- Select -'));
     // For a given entity type, load all entities.
     if ($config_type && $config_type !== 'system.simple') {
         $entity_storage = $this->entityManager->getStorage($config_type);
         foreach ($entity_storage->loadMultiple() as $entity) {
             $entity_id = $entity->id();
             if ($label = $entity->label()) {
                 $names[$entity_id] = new TranslatableMarkup('@label (@id)', ['@label' => $label, '@id' => $entity_id]);
             } else {
                 $names[$entity_id] = $entity_id;
             }
         }
     } else {
         // Gather the config entity prefixes.
         $config_prefixes = array_map(function (EntityTypeInterface $definition) {
             return $definition->getConfigPrefix() . '.';
         }, $this->definitions);
         // Find all config, and then filter our anything matching a config prefix.
         $names = $this->configStorage->listAll();
         $names = array_combine($names, $names);
         foreach ($names as $config_name) {
             foreach ($config_prefixes as $config_prefix) {
                 if (strpos($config_name, $config_prefix) === 0) {
                     unset($names[$config_name]);
                 }
             }
         }
     }
     return $names;
 }
开发者ID:318io,项目名称:318-io,代码行数:35,代码来源:ConfigSingleExportForm.php

示例6: copyConfig

 /**
  * Copies configuration objects from source storage to target storage.
  *
  * @param \Drupal\Core\Config\StorageInterface $source_storage
  *   The source config storage service.
  * @param \Drupal\Core\Config\StorageInterface $target_storage
  *   The target config storage service.
  */
 protected function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage)
 {
     $target_storage->deleteAll();
     foreach ($source_storage->listAll() as $name) {
         $target_storage->write($name, $source_storage->read($name));
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:15,代码来源:ConfigTestTrait.php

示例7: deleteAll

 /**
  * {@inheritdoc}
  */
 public function deleteAll($prefix = '')
 {
     $list = $this->storage->listAll();
     $result = TRUE;
     foreach ($list as $name) {
         $result = $this->delete($name) ? $result : FALSE;
     }
     return $result;
 }
开发者ID:gaelg,项目名称:drush,代码行数:12,代码来源:StorageWrapper.php

示例8: deleteAll

 /**
  * Implements Drupal\Core\Config\StorageInterface::deleteAll().
  */
 public function deleteAll($prefix = '')
 {
     // If the cache was the first to be deleted, another process might start
     // rebuilding the cache before the storage is renamed.
     $names = $this->storage->listAll($prefix);
     if ($this->storage->deleteAll($prefix)) {
         $this->cache->deleteMultiple($this->getCacheKeys($names));
         return TRUE;
     }
     return FALSE;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:CachedStorage.php

示例9: predefinedConfiguredLanguages

 /**
  * Compute the list of configuration names that match predefined languages.
  *
  * @return array
  *   The list of configuration names that match predefined languages.
  */
 protected function predefinedConfiguredLanguages()
 {
     $names = $this->configStorage->listAll('language.entity.');
     $predefined_languages = $this->languageManager->getStandardLanguageList();
     foreach ($names as $id => $name) {
         $langcode = str_replace('language.entity.', '', $name);
         if (!isset($predefined_languages[$langcode])) {
             unset($names[$id]);
         }
     }
     return array_values($names);
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:18,代码来源:LocaleDefaultConfigStorage.php

示例10: getComponentNames

 /**
  * Gets configuration names associated with components.
  *
  * @param array $components
  *   (optional) Array of component lists indexed by type. If not present or it
  *   is an empty array, it will update all components.
  *
  * @return array
  *   Array of configuration object names.
  */
 public function getComponentNames(array $components)
 {
     $components = array_filter($components);
     if ($components) {
         $names = array();
         foreach ($components as $type => $list) {
             // InstallStorage::getComponentNames returns a list of folders keyed by
             // config name.
             $names = array_merge($names, array_keys($this->installStorage->getComponentNames($type, $list)));
         }
         return $names;
     } else {
         return $this->installStorage->listAll();
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:25,代码来源:LocaleConfigManager.php

示例11: getConfigDependencyManager

 /**
  * {@inheritdoc}
  */
 public function getConfigDependencyManager()
 {
     $dependency_manager = new ConfigDependencyManager();
     // This uses the configuration storage directly to avoid blowing the static
     // caches in the configuration factory and the configuration entity system.
     // Additionally this ensures that configuration entity dependency discovery
     // has no dependencies on the config entity classes. Assume data with UUID
     // is a config entity. Only configuration entities can be depended on so we
     // can ignore everything else.
     $data = array_filter($this->activeStorage->readMultiple($this->activeStorage->listAll()), function ($config) {
         return isset($config['uuid']);
     });
     $dependency_manager->setData($data);
     return $dependency_manager;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:18,代码来源:ConfigManager.php

示例12: getDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     if (!isset($this->definitions)) {
         if ($cache = $this->cache->get($this::CACHE_ID)) {
             $this->definitions = $cache->data;
         } else {
             $this->definitions = array();
             foreach ($this->schemaStorage->readMultiple($this->schemaStorage->listAll()) as $schema) {
                 foreach ($schema as $type => $definition) {
                     $this->definitions[$type] = $definition;
                 }
             }
             $this->cache->set($this::CACHE_ID, $this->definitions);
         }
     }
     return $this->definitions;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:20,代码来源:TypedConfigManager.php

示例13: listAll

 /**
  * {@inheritdoc}
  */
 public function listAll($prefix = '')
 {
     $names = $this->storage->listAll($prefix);
     $additional_names = [];
     if ($prefix === '') {
         $additional_names = array_keys($this->replacementData[$this->collection]);
     } else {
         foreach (array_keys($this->replacementData[$this->collection]) as $name) {
             if (strpos($name, $prefix) === 0) {
                 $additional_names[] = $name;
             }
         }
     }
     if (!empty($additional_names)) {
         $names = array_unique(array_merge($names, $additional_names));
     }
     return $names;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:21,代码来源:StorageReplaceDataWrapper.php

示例14: findMissingContentDependencies

 /**
  * {@inheritdoc}
  */
 public function findMissingContentDependencies()
 {
     $content_dependencies = array();
     $missing_dependencies = array();
     foreach ($this->activeStorage->readMultiple($this->activeStorage->listAll()) as $config_data) {
         if (isset($config_data['dependencies']['content'])) {
             $content_dependencies = array_merge($content_dependencies, $config_data['dependencies']['content']);
         }
     }
     foreach (array_unique($content_dependencies) as $content_dependency) {
         // Format of the dependency is entity_type:bundle:uuid.
         list($entity_type, $bundle, $uuid) = explode(':', $content_dependency, 3);
         if (!$this->entityManager->loadEntityByUuid($entity_type, $uuid)) {
             $missing_dependencies[$uuid] = array('entity_type' => $entity_type, 'bundle' => $bundle, 'uuid' => $uuid);
         }
     }
     return $missing_dependencies;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:21,代码来源:ConfigManager.php

示例15: getFeaturesConfigDependencyManager

 /**
  * Creates a high performant version of the ConfigDependencyManager.
  *
  * @return \Drupal\features\FeaturesConfigDependencyManager
  *   A high performant version of the ConfigDependencyManager.
  *
  * @see \Drupal\Core\Config\Entity\ConfigDependencyManager
  */
 protected function getFeaturesConfigDependencyManager()
 {
     $dependency_manager = new FeaturesConfigDependencyManager();
     // Read all configuration using the factory. This ensures that multiple
     // deletes during the same request benefit from the static cache. Using the
     // factory also ensures configuration entity dependency discovery has no
     // dependencies on the config entity classes. Assume data with UUID is a
     // config entity. Only configuration entities can be depended on so we can
     // ignore everything else.
     $data = array_map(function (Drupal\Core\Config\ImmutableConfig $config) {
         $data = $config->get();
         if (isset($data['uuid'])) {
             return $data;
         }
         return FALSE;
     }, $this->configFactory->loadMultiple($this->configStorage->listAll()));
     $dependency_manager->setData(array_filter($data));
     return $dependency_manager;
 }
开发者ID:hugronaphor,项目名称:cornel,代码行数:27,代码来源:FeaturesManager.php


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