function views_handler_filter::show_build_group_button

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.

File

handlers/views_handler_filter.inc, line 420

Class

views_handler_filter
Base class for filters.

Code

public 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;
    }
}