class GroupByNumeric

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

Simple handler for arguments using group by.

Plugin annotation

@ViewsArgument("groupby_numeric");

Hierarchy

Expanded class hierarchy of GroupByNumeric

Related topics

File

core/modules/views/src/Plugin/views/argument/GroupByNumeric.php, line 12

Namespace

Drupal\views\Plugin\views\argument
View source
class GroupByNumeric extends ArgumentPluginBase {
  public function query($group_by = FALSE) {
    $this->ensureMyTable();
    $field = $this->getField();
    $placeholder = $this->placeholder();
    $this->query
      ->addHavingExpression(0, "{$field} = {$placeholder}", [
      $placeholder => $this->argument,
    ]);
  }
  public function adminLabel($short = FALSE) {
    return $this->getField(parent::adminLabel($short));
  }
  
  /**
   * {@inheritdoc}
   */
  public function getSortName() {
    return $this->t('Numerical', [], [
      'context' => 'Sort order',
    ]);
  }

}

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