public function Field::query in Zircon Profile 8
Same name in this branch
- 8 core/modules/views/src/Plugin/views/field/Field.php \Drupal\views\Plugin\views\field\Field::query()
- 8 core/modules/field/src/Plugin/migrate/source/d6/Field.php \Drupal\field\Plugin\migrate\source\d6\Field::query()
- 8 core/modules/field/src/Plugin/migrate/source/d7/Field.php \Drupal\field\Plugin\migrate\source\d7\Field::query()
Same name and namespace in other branches
- 8.0 core/modules/views/src/Plugin/views/field/Field.php \Drupal\views\Plugin\views\field\Field::query()
Called to add the field to a query.
By default, all needed data is taken from entities loaded by the query plugin. Columns are added only if they are used in groupings.
Overrides FieldPluginBase::query
File
- core/
modules/ views/ src/ Plugin/ views/ field/ Field.php, line 227 - Contains \Drupal\views\Plugin\views\field\Field.
Class
- Field
- A field that displays entity field data.
Namespace
Drupal\views\Plugin\views\fieldCode
public function query($use_groupby = FALSE) {
$fields = $this->additional_fields;
// No need to add the entity type.
$entity_type_key = array_search('entity_type', $fields);
if ($entity_type_key !== FALSE) {
unset($fields[$entity_type_key]);
}
if ($use_groupby) {
// Add the fields that we're actually grouping on.
$options = array();
if ($this->options['group_column'] != 'entity_id') {
$options = array(
$this->options['group_column'] => $this->options['group_column'],
);
}
$options += is_array($this->options['group_columns']) ? $this->options['group_columns'] : array();
// Go through the list and determine the actual column name from field api.
$fields = array();
foreach ($options as $column) {
$fields[$column] = $this
->getTableMapping()
->getFieldColumnName($this
->getFieldStorageDefinition(), $column);
}
$this->group_fields = $fields;
}
// Add additional fields (and the table join itself) if needed.
if ($this
->add_field_table($use_groupby)) {
$this
->ensureMyTable();
$this
->addAdditionalFields($fields);
}
// Let the entity field renderer alter the query if needed.
$this
->getEntityFieldRenderer()
->query($this->query, $this->relationship);
}