Esempio n. 1
0
 /**
  * @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));
         }
     }
 }
Esempio n. 2
0
 /**
  * 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();
       }
     }
   }
 }
 /**
  * Implements Mollom::deleteConfiguration().
  */
 public function deleteConfiguration($name)
 {
     $name = $this->configuration_map[$name];
     $this->config->clear($name)->save();
 }