You are here

class GroupByNumeric in Drupal 10

Same name in this branch
  1. 10 core/modules/views/src/Plugin/views/filter/GroupByNumeric.php \Drupal\views\Plugin\views\filter\GroupByNumeric
  2. 10 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php \Drupal\views\Plugin\views\sort\GroupByNumeric
  3. 10 core/modules/views/src/Plugin/views/argument/GroupByNumeric.php \Drupal\views\Plugin\views\argument\GroupByNumeric
Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php \Drupal\views\Plugin\views\sort\GroupByNumeric
  2. 9 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php \Drupal\views\Plugin\views\sort\GroupByNumeric

Handler for GROUP BY on simple numeric fields.

Plugin annotation

@ViewsSort("groupby_numeric");

Hierarchy

Expanded class hierarchy of GroupByNumeric

File

core/modules/views/src/Plugin/views/sort/GroupByNumeric.php, line 14

Namespace

Drupal\views\Plugin\views\sort
View source
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));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GroupByNumeric::adminLabel public function
GroupByNumeric::init public function
GroupByNumeric::query public function Called to add the field to a query. Overrides SortPluginBase::query
SortPluginBase::adminSummary public function Display whether or not the sort order is ascending or descending.
SortPluginBase::buildExposeForm public function
SortPluginBase::buildOptionsForm public function Basic options for all sort criteria. 2
SortPluginBase::canExpose public function Determine if a sort can be exposed.
SortPluginBase::defaultExposeOptions public function Provide default options for exposed sorts.
SortPluginBase::defineOptions protected function 1
SortPluginBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
SortPluginBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
SortPluginBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
SortPluginBase::showExposeButton public function Shortcut to display the expose/hide button.
SortPluginBase::showSortForm protected function Shortcut to display the value form.
SortPluginBase::sortOptions protected function Provide a list of options for the default sort form.
SortPluginBase::sortSubmit public function
SortPluginBase::sortValidate protected function
SortPluginBase::submitOptionsForm public function Simple submit handler.
SortPluginBase::trustedCallbacks public static function
SortPluginBase::validateExposeForm public function Validate the options form.
SortPluginBase::validateOptionsForm public function Simple validate handler.