protected function FieldPluginBase::addAdditionalFields in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::addAdditionalFields()
Add 'additional' fields to the query.
array(
'table' => $tablename,
'field' => $fieldname,
);
Parameters
$fields: An array of fields. The key is an identifier used to later find the field alias used. The value is either a string in which case it's assumed to be a field on this handler's table; or it's an array in the form of
8 calls to FieldPluginBase::addAdditionalFields()
- Field::query in core/
modules/ views/ src/ Plugin/ views/ field/ Field.php - Called to add the field to a query.
- FieldPluginBase::query in core/
modules/ views/ src/ Plugin/ views/ field/ FieldPluginBase.php - Called to add the field to a query.
- LinkBase::query in core/
modules/ views/ src/ Plugin/ views/ field/ LinkBase.php - Called to add the field to a query.
- NodeNewComments::query in core/
modules/ comment/ src/ Plugin/ views/ field/ NodeNewComments.php - Called to add the field to a query.
- Path::query in core/
modules/ node/ src/ Plugin/ views/ field/ Path.php - Called to add the field to a query.
File
- core/
modules/ views/ src/ Plugin/ views/ field/ FieldPluginBase.php, line 157 - Contains \Drupal\views\Plugin\views\field\FieldPluginBase.
Class
- FieldPluginBase
- Base class for views fields.
Namespace
Drupal\views\Plugin\views\fieldCode
protected function addAdditionalFields($fields = NULL) {
if (!isset($fields)) {
// notice check
if (empty($this->additional_fields)) {
return;
}
$fields = $this->additional_fields;
}
$group_params = array();
if ($this->options['group_type'] != 'group') {
$group_params = array(
'function' => $this->options['group_type'],
);
}
if (!empty($fields) && is_array($fields)) {
foreach ($fields as $identifier => $info) {
if (is_array($info)) {
if (isset($info['table'])) {
$table_alias = $this->query
->ensureTable($info['table'], $this->relationship);
}
else {
$table_alias = $this->tableAlias;
}
if (empty($table_alias)) {
debug(t('Handler @handler tried to add additional_field @identifier but @table could not be added!', array(
'@handler' => $this->definition['id'],
'@identifier' => $identifier,
'@table' => $info['table'],
)));
$this->aliases[$identifier] = 'broken';
continue;
}
$params = array();
if (!empty($info['params'])) {
$params = $info['params'];
}
$params += $group_params;
$this->aliases[$identifier] = $this->query
->addField($table_alias, $info['field'], NULL, $params);
}
else {
$this->aliases[$info] = $this->query
->addField($this->tableAlias, $info, NULL, $group_params);
}
}
}
}