public function BaseExtension::setSetting in Markdown 3.0.x
Sets a specific setting.
Parameters
string $name: The name of the setting to set.
mixed $value: (optional) The value to set. If not provided it will be removed.
Overrides MarkdownExtensionInterface::setSetting
1 call to BaseExtension::setSetting()
- BaseExtension::setSettings in src/
Plugin/ Markdown/ Extension/ BaseExtension.php - Provides settings to an extension.
File
- src/
Plugin/ Markdown/ Extension/ BaseExtension.php, line 177
Class
- BaseExtension
- Base class for markdown extensions.
Namespace
Drupal\markdown\Plugin\Markdown\ExtensionCode
public function setSetting($name, $value = NULL) {
if (isset($value)) {
// Get the type of the exist value (if any).
if (isset($this->configuration['settings'][$name]) && ($type = gettype($this->configuration['settings'][$name]))) {
$original_value = is_object($value) ? clone $value : $value;
if (!settype($value, $type)) {
$value = $original_value;
}
}
$this->configuration['settings'][$name] = $value;
}
else {
unset($this->configuration['settings'][$name]);
}
}