You are here

public function HandlerBase::buildGroupByForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::buildGroupByForm()

Provide a form for aggregation settings.

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 326

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

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,
  ];
}