You are here

protected function WizardPluginBase::defaultDisplaySorts in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplaySorts()
  2. 10 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php \Drupal\views\Plugin\views\wizard\WizardPluginBase::defaultDisplaySorts()

Retrieves all sort information used by the default display.

Additional to the one provided by the plugin this method takes care about adding additional sorts based on user input.

Parameters

array $form: The full wizard form array.

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

Return value

array An array of sort arrays keyed by ID. A sort array contains the options accepted by a sort handler.

1 call to WizardPluginBase::defaultDisplaySorts()
WizardPluginBase::buildDisplayOptions in core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
Builds an array of display options for the view.

File

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

Class

WizardPluginBase
Base class for Views wizard plugins.

Namespace

Drupal\views\Plugin\views\wizard

Code

protected function defaultDisplaySorts($form, FormStateInterface $form_state) {
  $sorts = [];

  // Add any sorts provided by the plugin.
  foreach ($this
    ->getSorts() as $name => $info) {
    $sorts[$name] = $info;
  }

  // Add any sorts specified by the user when filling out the wizard.
  $sorts = array_merge($sorts, $this
    ->defaultDisplaySortsUser($form, $form_state));
  return $sorts;
}