You are here

protected function WizardPluginBase::buildDisplayOptions in Drupal 9

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

2 calls to WizardPluginBase::buildDisplayOptions()
NodeRevision::buildDisplayOptions in core/modules/node/src/Plugin/views/wizard/NodeRevision.php
Builds an array of display options for the view.
WizardPluginBase::instantiateView in core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
Instantiates a view object from form values.
1 method overrides WizardPluginBase::buildDisplayOptions()
NodeRevision::buildDisplayOptions in core/modules/node/src/Plugin/views/wizard/NodeRevision.php
Builds an array of display options for the view.

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