You are here

protected function WizardPluginBase::buildDisplayOptions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::buildDisplayOptions()

Builds an array of display options for the view.

Return value

array An array whose keys are the names of each display and whose values are arrays of options for that display.

1 call to WizardPluginBase::buildDisplayOptions()
WizardPluginBase::instantiateView in core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
Instantiates a view object from form values.

File

core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php, line 685
Contains \Drupal\views\Plugin\views\wizard\WizardPluginBase.

Class

WizardPluginBase
Base class for Views wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function buildDisplayOptions($form, FormStateInterface $form_state) {

  // Display: Master
  $display_options['default'] = $this
    ->defaultDisplayOptions();
  $display_options['default'] += array(
    'filters' => array(),
    'sorts' => array(),
  );
  $display_options['default']['filters'] += $this
    ->defaultDisplayFilters($form, $form_state);
  $display_options['default']['sorts'] += $this
    ->defaultDisplaySorts($form, $form_state);

  // Display: Page
  if (!$form_state
    ->isValueEmpty(array(
    'page',
    'create',
  ))) {
    $display_options['page'] = $this
      ->pageDisplayOptions($form, $form_state);

    // Display: Feed (attached to the page)
    if (!$form_state
      ->isValueEmpty(array(
      'page',
      'feed',
    ))) {
      $display_options['feed'] = $this
        ->pageFeedDisplayOptions($form, $form_state);
    }
  }

  // Display: Block
  if (!$form_state
    ->isValueEmpty(array(
    'block',
    'create',
  ))) {
    $display_options['block'] = $this
      ->blockDisplayOptions($form, $form_state);
  }

  // Display: REST export.
  if (!$form_state
    ->isValueEmpty([
    'rest_export',
    'create',
  ])) {
    $display_options['rest_export'] = $this
      ->restExportDisplayOptions($form, $form_state);
  }
  return $display_options;
}