function WizardPluginBase::pageDisplayOptions

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::pageDisplayOptions()
  2. 8.9.x core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::pageDisplayOptions()
  3. 11.x core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::pageDisplayOptions()

Retrieves the page display options.

Parameters

array $form: The full wizard form array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the wizard form.

Return value

array Returns an array of display options.

2 calls to WizardPluginBase::pageDisplayOptions()
Node::pageDisplayOptions in core/modules/node/src/Plugin/views/wizard/Node.php
Retrieves the page display options.
WizardPluginBase::buildDisplayOptions in core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
Builds an array of display options for the view.
1 method overrides WizardPluginBase::pageDisplayOptions()
Node::pageDisplayOptions in core/modules/node/src/Plugin/views/wizard/Node.php
Retrieves the page display options.

File

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

Class

WizardPluginBase
Base class for Views wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function pageDisplayOptions(array $form, FormStateInterface $form_state) {
    $display_options = [];
    $page = $form_state->getValue('page');
    $display_options['title'] = $page['title'];
    $display_options['path'] = $page['path'];
    $display_options['style'] = [
        'type' => $page['style']['style_plugin'],
    ];
    // Not every style plugin supports row style plugins.
    // Make sure that the selected row plugin is a valid one.
    $options = $this->rowStyleOptions();
    $display_options['row'] = [
        'type' => isset($page['style']['row_plugin']) && isset($options[$page['style']['row_plugin']]) ? $page['style']['row_plugin'] : 'fields',
    ];
    // If the specific 0 items per page, use no pager.
    if (empty($page['items_per_page'])) {
        $display_options['pager']['type'] = 'none';
    }
    elseif (!empty($page['pager'])) {
        $display_options['pager']['type'] = 'mini';
    }
    else {
        $display_options['pager']['type'] = 'some';
    }
    $display_options['pager']['options']['items_per_page'] = $page['items_per_page'];
    // Generate the menu links settings if the user checked the link checkbox.
    if (!empty($page['link'])) {
        $display_options['menu']['type'] = 'normal';
        $display_options['menu']['title'] = $page['link_properties']['title'];
        [
            $display_options['menu']['menu_name'],
            $display_options['menu']['parent'],
        ] = explode(':', $page['link_properties']['parent'], 2);
    }
    return $display_options;
}

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