You are here

public function HandlerBase::buildGroupByForm in Views (for Drupal 7) 8.3

Provide a form for aggregation settings.

1 call to HandlerBase::buildGroupByForm()
Field::buildGroupByForm in lib/Views/field/Plugin/views/field/Field.php
Extend the groupby form with group columns.
1 method overrides HandlerBase::buildGroupByForm()
Field::buildGroupByForm in lib/Views/field/Plugin/views/field/Field.php
Extend the groupby form with group columns.

File

lib/Drupal/views/Plugin/views/HandlerBase.php, line 323
Definition of Drupal\views\Plugin\views\HandlerBase.

Class

HandlerBase

Namespace

Drupal\views\Plugin\views

Code

public function buildGroupByForm(&$form, &$form_state) {
  $view =& $form_state['view'];
  $display_id = $form_state['display_id'];
  $types = ViewExecutable::viewsHandlerTypes();
  $type = $form_state['type'];
  $id = $form_state['id'];
  $form['#title'] = check_plain($view->display[$display_id]['display_title']) . ': ';
  $form['#title'] .= t('Configure aggregation settings for @type %item', array(
    '@type' => $types[$type]['lstitle'],
    '%item' => $this
      ->adminLabel(),
  ));
  $form['#section'] = $display_id . '-' . $type . '-' . $id;
  $view
    ->initQuery();
  $info = $view->query
    ->get_aggregation_info();
  foreach ($info as $id => $aggregate) {
    $group_types[$id] = $aggregate['title'];
  }
  $form['group_type'] = array(
    '#type' => 'select',
    '#title' => t('Aggregation type'),
    '#default_value' => $this->options['group_type'],
    '#description' => t('Select the aggregation function to use on this field.'),
    '#options' => $group_types,
  );
}