3 namespace Drupal\views\Plugin\views\sort;
5 use Drupal\views\Plugin\views\display\DisplayPluginBase;
6 use Drupal\views\ViewExecutable;
7 use Drupal\views\Views;
10 * Handler for GROUP BY on simple numeric fields.
12 * @ViewsSort("groupby_numeric")
14 class GroupByNumeric extends SortPluginBase {
19 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
20 parent::init($view, $display, $options);
22 // Initialize the original handler.
23 $this->handler = Views::handlerManager('sort')->getHandler($options);
24 $this->handler->init($view, $display, $options);
28 * Called to add the field to a query.
30 public function query() {
31 $this->ensureMyTable();
34 'function' => $this->options['group_type'],
37 $this->query->addOrderBy($this->tableAlias, $this->realField, $this->options['order'], NULL, $params);
40 public function adminLabel($short = FALSE) {
41 return $this->getField(parent::adminLabel($short));