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


PHP Config::clear方法代码示例

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


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

示例1: testNestedClear

 /**
  * @covers ::clear
  * @dataProvider nestedDataProvider
  */
 public function testNestedClear($data)
 {
     foreach ($data as $key => $value) {
         // Check that values are cleared.
         $this->config->set($key, $value);
         // Check each nested value.
         foreach ($value as $nested_key => $nested_value) {
             $full_nested_key = $key . '.' . $nested_key;
             $this->assertEquals($nested_value, $this->config->get($full_nested_key));
             $this->config->clear($full_nested_key);
             $this->assertNull($this->config->get($full_nested_key));
         }
     }
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:18,代码来源:ConfigTest.php

示例2: settingsConvertToConfig

 /**
  * Set config for theme settings, core seems to have forgotten themes can
  * have custom settings that you probably very much need in config.
  */
 public function settingsConvertToConfig(array $values, Config $config) {
   foreach ($values as $key => $value) {
     // Save settings as config
     if (substr($key, 0, 9) == 'settings_') {
       $config_key = Unicode::substr($key, 9);
       $config->set('settings.' . $config_key, $value)->save();
     }
     // Delete suggestions config settings. We do not remove all the suggestions settings
     // because later on if the suggestion is recreated there will be settings for it already,
     // which is kind of nice for the user should they accidentally delete a suggestion.
     if (substr($key, 0, 18) == 'delete_suggestion_') {
       $delete_suggestion_key = 'settings.suggestion_' . Unicode::substr($key, 18);
       if ($value == 1) {
         $config->clear($delete_suggestion_key, $value)->save();
       }
     }
   }
 }
开发者ID:jno84,项目名称:drupal8,代码行数:22,代码来源:ThemeSettingsConfig.php

示例3: deleteConfiguration

 /**
  * Implements Mollom::deleteConfiguration().
  */
 public function deleteConfiguration($name)
 {
     $name = $this->configuration_map[$name];
     $this->config->clear($name)->save();
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:8,代码来源:DrupalClient.php


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