You are here

function views_plugin_display::set_override in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display.inc \views_plugin_display::set_override()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::set_override()

Flip the override setting for the given section.

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 2296
Contains the base display plugin.

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

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;
  }
}