You are here

public function ConfigEntityQuery::addField in Configuration Views 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/query/ConfigEntityQuery.php \Drupal\config_views\Plugin\views\query\ConfigEntityQuery::addField()

Add a field to the query table, possibly with an alias. This will automatically call ensureTable to make sure the required table exists, *unless* $table is unset.

Parameters

$table: The table this field is attached to. If NULL, it is assumed this will be a formula; otherwise, ensureTable is used to make sure the table exists.

$field: The name of the field to add. This may be a real field or a formula.

$alias: The alias to create. If not specified, the alias will be $table_$field unless $table is NULL. When adding formulae, it is recommended that an alias be used.

$params: An array of parameters additional to the field that will control items such as aggregation functions and DISTINCT. Some values that are recognized:

  • function: An aggregation function to apply, such as SUM.
  • aggregate: Set to TRUE to indicate that this value should be aggregated in a GROUP BY.

Return value

string The name that this field can be referred to as. Usually this is the alias.

Overrides Sql::addField

File

src/Plugin/views/query/ConfigEntityQuery.php, line 36

Class

ConfigEntityQuery
This query is able to work with config entities.

Namespace

Drupal\config_views\Plugin\views\query

Code

public function addField($table, $field, $alias = '', $params = []) {
  return $alias ? $alias : $field;
}