function views_handler::groupby_form

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

Provide a form for aggregation settings.

1 call to views_handler::groupby_form()
views_handler_field_field::groupby_form in modules/field/views_handler_field_field.inc
Extend the groupby form with group columns.
1 method overrides views_handler::groupby_form()
views_handler_field_field::groupby_form in modules/field/views_handler_field_field.inc
Extend the groupby form with group columns.

File

includes/handlers.inc, line 428
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,
  );
}