Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HandlerBase.php

function 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.

2 calls to HandlerBase::buildGroupByForm()
EntityField::buildGroupByForm in core/modules/views/src/Plugin/views/field/EntityField.php
Extend the groupby form with group columns.
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 344

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal