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


PHP StorageInterface::read方法代码示例

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


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

示例1: getAllFolders

 /**
  * Returns a map of all config object names and their folders.
  *
  * The list is based on enabled modules and themes. The active configuration
  * storage is used rather than \Drupal\Core\Extension\ModuleHandler and
  *  \Drupal\Core\Extension\ThemeHandler in order to resolve circular
  * dependencies between these services and \Drupal\Core\Config\ConfigInstaller
  * and \Drupal\Core\Config\TypedConfigManager.
  *
  * @return array
  *   An array mapping config object names with directories.
  */
 protected function getAllFolders()
 {
     if (!isset($this->folders)) {
         $this->folders = array();
         $this->folders += $this->getComponentNames('core', array('core'));
         $extensions = $this->configStorage->read('core.extension');
         if (!empty($extensions['module'])) {
             $modules = $extensions['module'];
             if (!$this->includeProfile) {
                 if ($install_profile = Settings::get('install_profile')) {
                     unset($modules[$install_profile]);
                 }
             }
             $this->folders += $this->getComponentNames('module', array_keys($modules));
         }
         if (!empty($extensions['theme'])) {
             $this->folders += $this->getComponentNames('theme', array_keys($extensions['theme']));
         }
         // The install profile can override module default configuration. We do
         // this by replacing the config file path from the module/theme with the
         // install profile version if there are any duplicates.
         $profile_folders = $this->getComponentNames('profile', array(drupal_get_profile()));
         $folders_to_replace = array_intersect_key($profile_folders, $this->folders);
         if (!empty($folders_to_replace)) {
             $this->folders = array_merge($this->folders, $folders_to_replace);
         }
     }
     return $this->folders;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:41,代码来源:ExtensionInstallStorage.php

示例2: get

 /**
  * {@inheritdoc}
  */
 public function get($name)
 {
     $data = $this->configStorage->read($name);
     $type_definition = $this->getDefinition($name);
     $data_definition = $this->buildDataDefinition($type_definition, $data);
     return $this->create($data_definition, $data);
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:10,代码来源:TypedConfigManager.php

示例3: read

 /**
  * {@inheritdoc}
  */
 public function read($name)
 {
     if (isset($this->replacementData[$this->collection][$name])) {
         return $this->replacementData[$this->collection][$name];
     }
     return $this->storage->read($name);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:StorageReplaceDataWrapper.php

示例4: loadOverrides

 /**
  * {@inheritdoc}
  */
 public function loadOverrides($names)
 {
     $overrides = array();
     // loadOverrides() runs on config entities, which means that if we try
     // to run this routine on our own data, then we end up in an infinite loop.
     // So ensure that we are _not_ looking up a domain.record.*.
     $check = current($names);
     $list = explode('.', $check);
     if (isset($list[0]) && isset($list[1]) && $list[0] == 'domain' && $list[1] == 'record') {
         return $overrides;
     }
     $this->initiateContext();
     if (!empty($this->domain)) {
         foreach ($names as $name) {
             $config_name = $this->getDomainConfigName($name, $this->domain);
             // Check to see if the config storage has an appropriately named file
             // containing override data.
             if ($override = $this->storage->read($config_name['langcode'])) {
                 $overrides[$name] = $override;
             } elseif ($override = $this->storage->read($config_name['domain'])) {
                 $overrides[$name] = $override;
             }
         }
     }
     return $overrides;
 }
开发者ID:dropdog,项目名称:play,代码行数:29,代码来源:DomainConfigOverrider.php

示例5: read

 /**
  * {@inheritdoc}
  */
 public function read($name)
 {
     $data = $this->storage->read($name);
     foreach ($this->filters as $filter) {
         $data = $filter->filterRead($name, $data);
     }
     return $data;
 }
开发者ID:bjargud,项目名称:drush,代码行数:11,代码来源:StorageWrapper.php

示例6: filterWrite

 public function filterWrite($name, array $data, StorageInterface $storage)
 {
     if ($name != 'core.extension') {
         return $data;
     }
     $originalData = $storage->read($name);
     return $this->filterOutIgnored($data, $storage->read($name));
 }
开发者ID:bjargud,项目名称:drush,代码行数:8,代码来源:CoreExtensionFilter.php

示例7: getAllFolders

 /**
  * Returns a map of all config object names and their folders.
  *
  * The list is based on enabled modules and themes. The active configuration
  * storage is used rather than \Drupal\Core\Extension\ModuleHandler and
  *  \Drupal\Core\Extension\ThemeHandler in order to resolve circular
  * dependencies between these services and \Drupal\Core\Config\ConfigInstaller
  * and \Drupal\Core\Config\TypedConfigManager.
  *
  * @return array
  *   An array mapping config object names with directories.
  */
 protected function getAllFolders()
 {
     if (!isset($this->folders)) {
         $this->folders = array();
         $this->folders += $this->getCoreNames();
         $install_profile = Settings::get('install_profile');
         $profile = drupal_get_profile();
         $extensions = $this->configStorage->read('core.extension');
         // @todo Remove this scan as part of https://www.drupal.org/node/2186491
         $listing = new ExtensionDiscovery(\Drupal::root());
         if (!empty($extensions['module'])) {
             $modules = $extensions['module'];
             // Remove the install profile as this is handled later.
             unset($modules[$install_profile]);
             $profile_list = $listing->scan('profile');
             if ($profile && isset($profile_list[$profile])) {
                 // Prime the drupal_get_filename() static cache with the profile info
                 // file location so we can use drupal_get_path() on the active profile
                 // during the module scan.
                 // @todo Remove as part of https://www.drupal.org/node/2186491
                 drupal_get_filename('profile', $profile, $profile_list[$profile]->getPathname());
             }
             $module_list_scan = $listing->scan('module');
             $module_list = array();
             foreach (array_keys($modules) as $module) {
                 if (isset($module_list_scan[$module])) {
                     $module_list[$module] = $module_list_scan[$module];
                 }
             }
             $this->folders += $this->getComponentNames($module_list);
         }
         if (!empty($extensions['theme'])) {
             $theme_list_scan = $listing->scan('theme');
             foreach (array_keys($extensions['theme']) as $theme) {
                 if (isset($theme_list_scan[$theme])) {
                     $theme_list[$theme] = $theme_list_scan[$theme];
                 }
             }
             $this->folders += $this->getComponentNames($theme_list);
         }
         if ($this->includeProfile) {
             // The install profile can override module default configuration. We do
             // this by replacing the config file path from the module/theme with the
             // install profile version if there are any duplicates.
             if (isset($profile)) {
                 if (!isset($profile_list)) {
                     $profile_list = $listing->scan('profile');
                 }
                 if (isset($profile_list[$profile])) {
                     $profile_folders = $this->getComponentNames(array($profile_list[$profile]));
                     $this->folders = $profile_folders + $this->folders;
                 }
             }
         }
     }
     return $this->folders;
 }
开发者ID:ravibarnwal,项目名称:laraitassociate.in,代码行数:69,代码来源:ExtensionInstallStorage.php

示例8: read

 /**
  * {@inheritdoc}
  */
 public function read($name)
 {
     $data = $this->baseStorage->read($name);
     if ($name == 'core.extension' && isset($data['module'])) {
         // Remove any profiles from the list. These will be installed later.
         // @see config_installer_config_import_profile()
         $data['module'] = array_diff_key($data['module'], $this->profiles);
     }
     return $data;
 }
开发者ID:tedbow,项目名称:scheduled-updates-demo,代码行数:13,代码来源:SourceStorage.php

示例9: read

 /**
  * Implements Drupal\Core\Config\StorageInterface::read().
  */
 public function read($name)
 {
     if ($cache = $this->cache->get($name)) {
         // The cache contains either the cached configuration data or FALSE
         // if the configuration file does not exist.
         return $cache->data;
     }
     // Read from the storage on a cache miss and cache the data. Also cache
     // information about missing configuration objects.
     $data = $this->storage->read($name);
     $this->cache->set($name, $data);
     return $data;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:CachedStorage.php

示例10: 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

示例11: createItemSnapshot

 /**
  * Creates a snapshot of a given configuration item as provided by an
  * extension.
  *
  * @param FileStorage $extension_storage
  *   An extension's configuration file storage.
  * @param string $item_name
  *   The name of the configuration item.
  */
 function createItemSnapshot(FileStorage $extension_storage, $item_name)
 {
     // Snapshot the configuration item as provided by the extension.
     $extension_value = $extension_storage->read($item_name);
     $this->snapshotExtensionStorage->write($item_name, $extension_value);
     // Snapshot the configuration item as installed in the active storage.
     $active_value = $this->activeStorage->read($item_name);
     $this->snapshotActiveStorage->write($item_name, $active_value);
 }
开发者ID:robertfoleyjr,项目名称:robertfoleyjr-d8,代码行数:18,代码来源:ConfigSyncSnapshotter.php

示例12: getFromExtension

 /**
  * {@inheritdoc}
  */
 public function getFromExtension($type, $name)
 {
     $full_name = $this->getFullName($type, $name);
     $value = $this->extensionConfigStorage->read($full_name);
     if (!$value) {
         $value = $this->extensionOptionalConfigStorage->read($full_name);
     }
     return $value;
 }
开发者ID:curveagency,项目名称:intranet,代码行数:12,代码来源:ConfigReverter.php

示例13: read

 /**
  * Read a configuration from install storage or default languages.
  *
  * @param string $name
  *   Configuration object name.
  *
  * @return array
  *   Configuration data from install storage or default language.
  */
 public function read($name)
 {
     if ($this->requiredInstallStorage->exists($name)) {
         return $this->requiredInstallStorage->read($name);
     } elseif ($this->optionalInstallStorage->exists($name)) {
         return $this->optionalInstallStorage->read($name);
     } elseif (strpos($name, 'language.entity.') === 0) {
         // Simulate default languages as if they were shipped as default
         // configuration.
         $langcode = str_replace('language.entity.', '', $name);
         $predefined_languages = $this->languageManager->getStandardLanguageList();
         if (isset($predefined_languages[$langcode])) {
             $data = $this->configStorage->read($name);
             $data['label'] = $predefined_languages[$langcode][0];
             return $data;
         }
     }
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:27,代码来源:LocaleDefaultConfigStorage.php

示例14: addConfigList

 protected function addConfigList($full_name, &$list) {
   if (!in_array($full_name, $list)) {
     array_unshift($list, $full_name);
     $value = $this->extensionStorage->read($full_name);
     if (isset($value['dependencies']['config'])) {
       foreach ($value['dependencies']['config'] as $config_name) {
         $this->addConfigList($config_name, $list);
       }
     }
   }
 }
开发者ID:jeetendrasingh,项目名称:manage_profile,代码行数:11,代码来源:FeaturesManager.php

示例15: filterWrite

 public function filterWrite($name, array $data, StorageInterface $storage)
 {
     if ($name == 'core.extension') {
         return $this->filterOutIgnored($data, $storage->read($name));
     }
     $dependent_configs = $this->getAllDependentConfigs($storage);
     if (in_array($name, $dependent_configs)) {
         $data = ($existing = $storage->read($name)) ? $existing : NULL;
     }
     return $data;
 }
开发者ID:gaelg,项目名称:drush,代码行数:11,代码来源:CoreExtensionFilter.php


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