public static function Config::clear in Geocoder 7.2
Removes a configuration value.
Parameters
string|array $parents: The path to the configuration value. Strings use dots as path separator.
Return value
array The configuration array.
File
- src/
Config.php, line 120 - Class Config.
Class
- Config
- Class Config.
Namespace
Drupal\geocoderCode
public static function clear($parents) {
$config = \Drupal::service('variable')
->get('geocoder_config', array());
$ref =& $config;
if (is_string($parents)) {
$parents = explode('.', $parents);
}
$last = end($parents);
reset($parents);
foreach ($parents as $parent) {
if (isset($ref) && !is_array($ref)) {
$ref = array();
}
if ($last == $parent) {
unset($ref[$parent]);
}
else {
if (isset($ref[$parent])) {
$ref =& $ref[$parent];
}
else {
break;
}
}
}
\Drupal::service('variable')
->set('geocoder_config', $config);
return $config;
}