Called to add the field to a query.
Overrides PluginBase::query
public function query() {
$this
->ensureMyTable();
// Add the field.
$params = $this->options['group_type'] != 'group' ? array(
'function' => $this->options['group_type'],
) : array();
$this->field_alias = $this->query
->add_field($this->tableAlias, $this->realField, NULL, $params);
$this
->add_additional_fields();
}