GroupByNumeric.php

Same filename in this branch
  1. 9 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
  2. 9 core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
Same filename in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
  2. 8.9.x core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
  3. 8.9.x core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
  4. 10 core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
  5. 10 core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
  6. 10 core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
  7. 11.x core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
  8. 11.x core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
  9. 11.x core/modules/views/src/Plugin/views/argument/GroupByNumeric.php

Namespace

Drupal\views\Plugin\views\argument

File

core/modules/views/src/Plugin/views/argument/GroupByNumeric.php

View source
<?php

namespace Drupal\views\Plugin\views\argument;


/**
 * Simple handler for arguments using group by.
 *
 * @ingroup views_argument_handlers
 *
 * @ViewsArgument("groupby_numeric")
 */
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',
        ]);
    }

}

Classes

Title Deprecated Summary
GroupByNumeric Simple handler for arguments using group by.

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