You are here

function hs_taxonomy_views_handler_filter_term_node_tid::extra_options_form in Hierarchical Select 6.3

1 call to hs_taxonomy_views_handler_filter_term_node_tid::extra_options_form()
hs_taxonomy_views_handler_filter_term_node_tid_depth::extra_options_form in modules/hs_taxonomy_views_handler_filter_term_node_tid_depth.inc
1 method overrides hs_taxonomy_views_handler_filter_term_node_tid::extra_options_form()
hs_taxonomy_views_handler_filter_term_node_tid_depth::extra_options_form in modules/hs_taxonomy_views_handler_filter_term_node_tid_depth.inc

File

modules/hs_taxonomy_views_handler_filter_term_node_tid.inc, line 150
This file defines a new filter handler for using Hierarchical Select in exposed Taxonomy term filters.

Class

hs_taxonomy_views_handler_filter_term_node_tid
@file This file defines a new filter handler for using Hierarchical Select in exposed Taxonomy term filters.

Code

function extra_options_form(&$form, &$form_state) {
  parent::extra_options_form($form, $form_state);
  $form['type'] = array(
    '#type' => 'radios',
    '#title' => t('Selection type'),
    '#options' => array(
      'select' => t('Dropdown'),
      'textfield' => t('Autocomplete'),
      'hierarchical_select' => t('Hierarchical Select'),
    ),
    '#default_value' => $this->options['type'],
  );
  $filter_id = $form_state['id'];
  $display_id = _hs_taxonomy_views_get_display_id_for_filter($this->view, $filter_id);
  $form['configure_hs'] = array(
    '#prefix' => '<div class="form-item"><div id="configure-hierarchical-select-link" style="display: inline-block">',
    '#value' => l(t('Configure Hierarchical Select'), _hs_taxonomy_views_config_path($this->view->name, $display_id, $filter_id)),
    '#suffix' => '</div></div>',
    // Doesn't work because #process is not called for #type = markup form items.
    '#process' => array(
      'views_process_dependency',
    ),
    '#dependency' => array(
      'radio:options[type]' => array(
        'hierarchical_select',
      ),
    ),
    // Set #input = TRUE so that #process will be called.
    '#input' => TRUE,
    // Set #id manually because that is not generated for #type = markup.
    // This is the same id attribute as in #prefix.
    '#id' => 'configure-hierarchical-select-link',
  );

  // Ensure the configure_hs form item is before the markup_end form item.
  unset($form['markup_end']);
  $form['markup_end'] = array(
    '#value' => '</div>',
  );
}