Flip the override setting for the given section.
string $section: Which option should be marked as overridden, for example "filters".
bool $new_state: Select the new state of the option.
public function setOverride($section, $new_state = NULL) {
$options = $this
->defaultableSections($section);
if (!$options) {
return;
}
if (!isset($new_state)) {
$new_state = empty($this->options['defaults'][$section]);
}
// For each option that is part of this group, fix our settings.
foreach ($options as $option) {
if ($new_state) {
// Revert to defaults.
unset($this->options[$option]);
unset($this->display['display_options'][$option]);
}
else {
// copy existing values into our display.
$this->options[$option] = $this
->getOption($option);
$this->display['display_options'][$option] = $this->options[$option];
}
$this->options['defaults'][$option] = $new_state;
$this->display['display_options']['defaults'][$option] = $new_state;
}
}