function views_handler_filter::show_build_group_button

3.x views_handler_filter.inc views_handler_filter::show_build_group_button(&$form, &$form_state)

Shortcut to display the build_group/hide button.

1 call to views_handler_filter::show_build_group_button()
views_handler_filter::options_form in handlers/views_handler_filter.inc
Provide the basic form which calls through to subforms. If overridden, it is best to call through to the parent, or to at least make sure all of the functions in this form are called.

File

handlers/views_handler_filter.inc, line 368
@todo.

Class

views_handler_filter
Base class for filters.

Code

function show_build_group_button(&$form, &$form_state) {

  $form['group_button'] = array(
    '#prefix' => '<div class="views-grouped clearfix">',
    '#suffix' => '</div>',
    // Should always come after the description and the relationship.
    '#weight' => -190,
  );

  $grouped_description = t('Grouped filters allow a choice between predefined operator|value pairs.');
  $form['group_button']['radios'] = array(
    '#theme_wrappers' => array('container'),
    '#attributes' => array('class' => array('js-only')),
  );
  $form['group_button']['radios']['radios'] = array(
    '#title' => t('Filter type to expose'),
    '#description' => $grouped_description,
    '#type' => 'radios',
    '#options' => array(
      t('Single filter'),
      t('Grouped filters'),
    ),
  );

  if (empty($this->options['is_grouped'])) {
    $form['group_button']['markup'] = array(
      '#markup' => '<div class="description grouped-description">' . $grouped_description . '</div>',
    );
    $form['group_button']['button'] = array(
      '#limit_validation_errors' => array(),
      '#type' => 'submit',
      '#value' => t('Grouped filters'),
      '#submit' => array('views_ui_config_item_form_build_group'),
    );
    $form['group_button']['radios']['radios']['#default_value'] = 0;
  }
  else {
    $form['group_button']['button'] = array(
      '#limit_validation_errors' => array(),
      '#type' => 'submit',
      '#value' => t('Single filter'),
      '#submit' => array('views_ui_config_item_form_build_group'),
    );
    $form['group_button']['radios']['radios']['#default_value'] = 1;
  }
}