1 views_ui_base_views_wizard.php protected ViewsUiBaseViewsWizard::add_displays($view, $display_options, $form, $form_state)

Add the array of display options to the view, with appropriate overrides.

File

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

Class

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

Code

protected function add_displays($view, $display_options, $form, $form_state) {
  // Display: Default
  $default_display = $view->new_display('default', 'Default', 'default');
  foreach ($display_options['default'] as $option => $value) {
    $default_display->set_option($option, $value);
  }

  // Display: Page
  if (isset($display_options['page'])) {
    $display = $view->new_display('page', 'Page', 'page');
    // The page display is usually the main one (from the user's point of
    // view). Its options should therefore become the overall view defaults,
    // so that new displays which are added later automatically inherit them.
    $this->set_default_options($display_options['page'], $display, $default_display);

    // Display: Feed (attached to the page)
    if (isset($display_options['feed'])) {
      $display = $view->new_display('feed', 'Feed', 'feed');
      $this->set_override_options($display_options['feed'], $display, $default_display);
    }
  }

  // Display: Block
  if (isset($display_options['block'])) {
    $display = $view->new_display('block', 'Block', 'block');
    // When there is no page, the block display options should become the
    // overall view defaults.
    if (!isset($display_options['page'])) {
      $this->set_default_options($display_options['block'], $display, $default_display);
    }
    else {
      $this->set_override_options($display_options['block'], $display, $default_display);
    }
  }
}