You are here

protected function WizardPluginBase::pageDisplayOptions 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::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 1026
Contains \Drupal\views\Plugin\views\wizard\WizardPluginBase.

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 = array();
  $page = $form_state
    ->getValue('page');
  $display_options['title'] = $page['title'];
  $display_options['path'] = $page['path'];
  $display_options['style'] = array(
    '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'] = array(
    '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 (isset($page['pager'])) {
    $display_options['pager']['type'] = 'full';
  }
  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'] = $page['link_properties']['menu_name'];
  }
  return $display_options;
}