function WizardPluginBase::buildDisplayOptions

Same name and namespace in other branches
  1. 11.x 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.

File

core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php, line 720

Class

WizardPluginBase
Base class for Views wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function buildDisplayOptions($form, FormStateInterface $form_state) {
  // Display: Default
  $display_options['default'] = $this->defaultDisplayOptions();
  $display_options['default'] += [
    'filters' => [],
    'sorts' => [],
  ];
  $display_options['default']['filters'] += $this->defaultDisplayFilters($form, $form_state);
  $display_options['default']['sorts'] += $this->defaultDisplaySorts($form, $form_state);
  // Display: Page
  if (!$form_state->isValueEmpty([
    'page',
    'create',
  ])) {
    $display_options['page'] = $this->pageDisplayOptions($form, $form_state);
    // Display: Feed (attached to the page)
    if (!$form_state->isValueEmpty([
      'page',
      'feed',
    ])) {
      $display_options['feed'] = $this->pageFeedDisplayOptions($form, $form_state);
    }
  }
  // Display: Block
  if (!$form_state->isValueEmpty([
    '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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.