當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。