function ArgumentPluginBase::defaultSummary

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

Default action: summary.

If an argument was expected and was not given, in this case, display a summary query.

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 879

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

protected function defaultSummary() {
    $this->view->build_info['summary'] = TRUE;
    $this->view->build_info['summary_level'] = $this->options['id'];
    // Change the display style to the summary style for this
    // argument.
    $this->view->style_plugin = Views::pluginManager("style")->createInstance($this->options['summary']['format']);
    $this->view->style_plugin
        ->init($this->view, $this->displayHandler, $this->options['summary_options']);
    // Clear out the normal primary field and whatever else may have
    // been added and let the summary do the work.
    $this->query
        ->clearFields();
    $this->summaryQuery();
    $by = $this->options['summary']['number_of_records'] ? 'num_records' : NULL;
    $this->summarySort($this->options['summary']['sort_order'], $by);
    // Summaries have their own sorting and fields, so tell the View not
    // to build these.
    $this->view->build_sort = FALSE;
    return TRUE;
}

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