function WizardPluginBase::defaultDisplaySorts

Same name in other branches
  1. 8.9.x 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()
  3. 11.x 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 993

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

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