1 handlers.inc views_handler::groupby_form(&$form, &$form_state)

Provide a form for aggregation settings.

File

core/modules/views/includes/handlers.inc, line 317
Defines the various handler objects to help build and display views.

Class

views_handler
Base handler, from which all the other handlers are derived. It creates a common interface to create consistency amongst handlers and data.

Code

function groupby_form(&$form, &$form_state) {
  $view = &$form_state['view'];
  $display_id = $form_state['display_id'];
  $types = views_object_types();
  $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->ui_name()));

  $form['#section'] = $display_id . '-' . $type . '-' . $id;

  $view->init_query();
  $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,
  );
}