Provide a form for aggregation settings.
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,
);
}