function HandlerBase::buildGroupByForm
Same name in other branches
- 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildGroupByForm()
- 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildGroupByForm()
- 11.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildGroupByForm()
Provide a form for aggregation settings.
Parameters
array $form: An alterable, associative array containing the structure of the form, passed by reference.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 call to HandlerBase::buildGroupByForm()
- EntityField::buildGroupByForm in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Extend the groupby form with group columns.
1 method overrides HandlerBase::buildGroupByForm()
- EntityField::buildGroupByForm in core/
modules/ views/ src/ Plugin/ views/ field/ EntityField.php - Extend the groupby form with group columns.
File
-
core/
modules/ views/ src/ Plugin/ views/ HandlerBase.php, line 343
Class
- HandlerBase
- Base class for Views handler plugins.
Namespace
Drupal\views\Plugin\viewsCode
public function buildGroupByForm(&$form, FormStateInterface $form_state) {
$display_id = $form_state->get('display_id');
$type = $form_state->get('type');
$id = $form_state->get('id');
$form['#section'] = $display_id . '-' . $type . '-' . $id;
$this->view
->initQuery();
$info = $this->view->query
->getAggregationInfo();
foreach ($info as $id => $aggregate) {
$group_types[$id] = $aggregate['title'];
}
$form['group_type'] = [
'#type' => 'select',
'#title' => $this->t('Aggregation type'),
'#default_value' => $this->options['group_type'],
'#description' => $this->t('Select the aggregation function to use on this field.'),
'#options' => $group_types,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.