function FacetapiMultiSelectWidget::settingsForm in Facetapi Multiselect 7
Allows the widget to provide additional settings to the form.
File
- plugins/
facetapi/ facetapi_multiselect.inc, line 105 - Defines a plugin for a multiselect facet API widget.
Class
- FacetapiMultiSelectWidget
- Widget that renders facets as a multiselect element.
Code
function settingsForm(&$form, &$form_state) {
$form['widget']['widget_settings']['links'][$this->id]['add_count'] = array(
'#type' => 'checkbox',
'#title' => t('Add count'),
'#description' => t('Add available item count in brackets.'),
'#default_value' => $this->settings->settings['add_count'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['remove_count_on_active'] = array(
'#type' => 'checkbox',
'#title' => t('Remove parenthetical counts on active items'),
'#description' => t('Counts will only appear for unselected items, ideal for Chosen theming.'),
'#default_value' => $this->settings->settings['remove_count_on_active'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
'input[name="add_count"]' => array(
'checked' => TRUE,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['disable_empty'] = array(
'#type' => 'checkbox',
'#title' => t('Show empty facets as disabled'),
'#description' => t('When facets have zero items, show them anyway, but disallow selecting them.'),
'#default_value' => $this->settings->settings['disable_empty'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['remove_selected'] = array(
'#type' => 'checkbox',
'#title' => t('Remove selected'),
'#description' => t('Remove selected options from select list.'),
'#default_value' => $this->settings->settings['remove_selected'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['auto_submit'] = array(
'#type' => 'checkbox',
'#title' => t('Autosubmit'),
'#description' => t('Hide submit button and submit selection automatically.'),
'#default_value' => $this->settings->settings['auto_submit'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['act_single'] = array(
'#type' => 'checkbox',
'#title' => t('Act as single select element'),
'#description' => t('Change query path to work with facets from connected fields.'),
'#default_value' => $this->settings->settings['act_single'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['optgroups'] = array(
'#type' => 'checkbox',
'#title' => t('Nest hierarchical facets in optgroups.'),
'#description' => t('Parent facets will be rendered as optgroups in the select element.'),
'#default_value' => $this->settings->settings['optgroups'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
$form['widget']['widget_settings']['links'][$this->id]['placeholder_label'] = array(
'#type' => 'textfield',
'#title' => t('Facet placeholder text'),
'#description' => t('The placeholder text will appear before any options are selected.'),
'#default_value' => $this->settings->settings['placeholder_label'],
'#states' => array(
'visible' => array(
'select[name="widget"]' => array(
'value' => $this->id,
),
),
),
);
}