You are here

public function shs_handler_filter_entityreference::options_form in Simple hierarchical select 7

Build the options form.

Parameters

array $form: Current form structure.

array $form_state: Current form state.

Overrides views_handler_filter::options_form

File

includes/handlers/shs_handler_filter_entityreference.inc, line 35
Definition of shs_handler_filter_numeric.

Class

shs_handler_filter_entityreference
Extends simple numeric filter with hierarchical selection.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['shs_enabled'] = array(
    '#type' => 'checkbox',
    '#title' => t('Output filter as hierarchical select'),
    '#default_value' => $this->options['shs_enabled'],
  );
  if (module_exists('chosen')) {
    $form['use_chosen'] = array(
      '#type' => 'select',
      '#title' => t('Output this field with !chosen', array(
        '!chosen' => l(t('Chosen'), 'http://drupal.org/project/chosen'),
      )),
      '#description' => t('Select in which cases the element will use the !chosen module for the term selection of each level.', array(
        '!chosen' => l(t('Chosen'), 'http://drupal.org/project/chosen'),
      )),
      '#default_value' => empty($this->options['use_chosen']) ? 'never' : $this->options['use_chosen'],
      '#dependency' => array(
        'edit-options-shs-enabled' => array(
          1,
        ),
      ),
      '#options' => array(
        'chosen' => t('let chosen decide'),
        'always' => t('always'),
        'never' => t('never'),
      ),
    );
  }
}