GroupByNumeric.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
- 9 core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
- 9 core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
- 10 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
- 10 core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
- 10 core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
- 11.x core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
- 11.x core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
- 11.x core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
Namespace
Drupal\views\Plugin\views\sortFile
-
core/
modules/ views/ src/ Plugin/ views/ sort/ GroupByNumeric.php
View source
<?php
namespace Drupal\views\Plugin\views\sort;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
/**
* Handler for GROUP BY on simple numeric fields.
*
* @ViewsSort("groupby_numeric")
*/
class GroupByNumeric extends SortPluginBase {
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
// Initialize the original handler.
$this->handler = Views::handlerManager('sort')->getHandler($options);
$this->handler
->init($view, $display, $options);
}
/**
* Called to add the field to a query.
*/
public function query() {
$this->ensureMyTable();
$params = [
'function' => $this->options['group_type'],
];
$this->query
->addOrderBy($this->tableAlias, $this->realField, $this->options['order'], NULL, $params);
}
public function adminLabel($short = FALSE) {
return $this->getField(parent::adminLabel($short));
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
GroupByNumeric | Handler for GROUP BY on simple numeric fields. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.