You are here

public function HandlerBase::getField in Views (for Drupal 7) 8.3

Shortcut to get a handler's raw field value.

This should be overridden for handlers with formulae or other non-standard fields. Because this takes an argument, fields overriding this can just call return parent::getField($formula)

6 calls to HandlerBase::getField()
FieldPluginBase::adminLabel in lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in lib/Drupal/views/Plugin/views/sort/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::adminLabel in lib/Drupal/views/Plugin/views/filter/GroupByNumeric.php
Return a string representing this handler's name in the UI.
GroupByNumeric::query in lib/Drupal/views/Plugin/views/argument/GroupByNumeric.php
Set up the query for this argument.

... See full list

File

lib/Drupal/views/Plugin/views/HandlerBase.php, line 179
Definition of Drupal\views\Plugin\views\HandlerBase.

Class

HandlerBase

Namespace

Drupal\views\Plugin\views

Code

public function getField($field = NULL) {
  if (!isset($field)) {
    if (!empty($this->formula)) {
      $field = $this
        ->get_formula();
    }
    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
        ->get_aggregation_info();
      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;
}