function HandlerBase::getField

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getField()
  2. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getField()
  3. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getField()

Overrides ViewsHandlerInterface::getField

6 calls to HandlerBase::getField()
FieldPluginBase::adminLabel in core/modules/views/src/Plugin/views/field/FieldPluginBase.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in core/modules/views/src/Plugin/views/sort/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in core/modules/views/src/Plugin/views/argument/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::query in core/modules/views/src/Plugin/views/filter/GroupByNumeric.php
Add this filter to the query.

... See full list

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 173

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public function getField($field = NULL) {
    if (!isset($field)) {
        if (!empty($this->formula)) {
            $field = $this->getFormula();
        }
        else {
            $field = $this->tableAlias . '.' . $this->realField;
        }
    }
    // If grouping, check to see if the aggregation method needs to modify the field.
    if ($this->view->display_handler
        ->useGroupBy()) {
        $this->view
            ->initQuery();
        if ($this->query) {
            $info = $this->query
                ->getAggregationInfo();
            if (!empty($info[$this->options['group_type']]['method'])) {
                $method = $info[$this->options['group_type']]['method'];
                if (method_exists($this->query, $method)) {
                    return $this->query
                        ->{$method}($this->options['group_type'], $field);
                }
            }
        }
    }
    return $field;
}

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