1 views_ui_base_views_wizard.php protected ViewsUiBaseViewsWizard::set_default_options($options, $display, $default_display)

Sets options for a display and makes them the default options if possible.

This function can be used to set options for a display when it is desired that the options also become the defaults for the view whenever possible. This should be done for the "primary" display created in the view wizard, so that new displays which the user adds later will be similar to this one.


$options: An array whose keys are the name of each option and whose values are the desired values to set.

$display: The display which the options will be applied to. The default display will actually be assigned the options (and this display will inherit them) when possible.

$default_display: The default display, which will store the options when possible.


core/modules/views_ui/wizards/views_ui_base_views_wizard.php, line 858
Provides the interface and base class for Views Wizard plugins.


A very generic Views Wizard class - can be constructed for any base table.


protected function set_default_options($options, $display, $default_display) {
  foreach ($options as $option => $value) {
    // If the default display supports this option, set the value there.
    // Otherwise, set it on the provided display.
    $default_value = $default_display->get_option($option);
    if (isset($default_value)) {
      $default_display->set_option($option, $value);
    else {
      $display->set_option($option, $value);