function views_plugin_display::set_override
Flip the override setting for the given section.
Parameters
string $section: Which option should be marked as overridden, for example "filters".
bool $new_state: Select the new state of the option.
- TRUE: Revert to default.
- FALSE: Mark it as overridden.
2 calls to views_plugin_display::set_override()
- views_plugin_display::options_override in plugins/
views_plugin_display.inc - If override/revert was clicked, perform the proper toggle.
- views_plugin_display::override_option in plugins/
views_plugin_display.inc - Set an option and force it to be an override.
File
-
plugins/
views_plugin_display.inc, line 2665
Class
- views_plugin_display
- The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.
Code
public function set_override($section, $new_state = NULL) {
$options = $this->defaultable_sections($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->get_option($option);
$this->display->display_options[$option] = $this->options[$option];
}
$this->options['defaults'][$option] = $new_state;
$this->display->display_options['defaults'][$option] = $new_state;
}
}