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