You are here

function FacetapiCollapsible::settingsForm in Facet API Collapsible 7

Adds option to keep facets open.

File

./collapsible_widget.inc, line 52

Class

FacetapiCollapsible
Widget that renders facets as a list of clickable links.

Code

function settingsForm(&$form, &$form_state) {
  parent::settingsForm($form, $form_state);
  $settings = $this->settings->settings;
  $form['widget']['widget_settings']['collapsible_links'][$this->id] = array(
    'keep_open' => array(
      '#type' => 'checkbox',
      '#title' => t('Keep open'),
      '#default_value' => isset($settings['keep_open']) ? $settings['keep_open'] : 0,
      '#description' => t('If checked, facets that are already expanded will stay expanded when you click on another facet, otherwise they will close.'),
      '#states' => array(
        'visible' => array(
          'select[name="widget"]' => array(
            'value' => $this->id,
          ),
        ),
      ),
    ),
    'expand' => array(
      '#type' => 'checkbox',
      '#title' => t('Expand'),
      '#default_value' => isset($settings['expand']) ? $settings['expand'] : 1,
      '#description' => t('If checked, this facet will automatically expand.'),
      '#states' => array(
        'visible' => array(
          'select[name="widget"]' => array(
            'value' => $this->id,
          ),
        ),
      ),
    ),
    'collapsible_children' => array(
      '#type' => 'checkbox',
      '#title' => t('Collapsible children'),
      '#default_value' => isset($settings['collapsible_children']) ? $settings['collapsible_children'] : 0,
      '#description' => t('If checked, this facet\'s children will be collapsible as well.'),
      '#states' => array(
        'visible' => array(
          'select[name="widget"]' => array(
            'value' => $this->id,
          ),
        ),
      ),
    ),
  );
}