function WizardPluginBase::buildDisplayOptions

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::buildDisplayOptions()
  2. 8.9.x core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::buildDisplayOptions()
  3. 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.

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 719

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.