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/argument/GroupByNumeric.php \Drupal\views\Plugin\views\argument\GroupByNumeric
  2. 9 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

  • class \Drupal\views\Plugin\views\argument\GroupByNumeric extends \Drupal\views\Plugin\views\argument\ArgumentPluginBase

Expanded class hierarchy of GroupByNumeric

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',
    ]);
  }

}

Members