public function CurrentSearchItem::wrapperForm in Facet API 7
Same name and namespace in other branches
- 6.3 contrib/current_search/plugins/current_search/item.inc \CurrentSearchItem::wrapperForm()
- 7.2 contrib/current_search/plugins/current_search/item.inc \CurrentSearchItem::wrapperForm()
Returns form elements that allow users to add wrapper HTML around items.
Inspired by Semantic Views which was integrated into Views 3, these form elements allow the user to add wrapper HTML and CSS classes around the current search items for easier theming and better semantic markup. This method is usually called in CurrentSearchItem::settingsForm() overrides.
Return value
array The wrapper HTML form elements.
See also
CurrentSearchItem::settingsForm()
1 call to CurrentSearchItem::wrapperForm()
- CurrentSearchItemText::settingsForm in contrib/
current_search/ plugins/ current_search/ item_text.inc - Implements CurrentSearchItem::settingsForm().
File
- contrib/
current_search/ plugins/ current_search/ item.inc, line 139 - Base current search item plugin class.
Class
- CurrentSearchItem
- Abstract class extended by current search item plugins.
Code
public function wrapperForm(&$form, &$form_state) {
$form['wrapper'] = array(
'#type' => 'checkbox',
'#title' => t('Customize wrapper HTML'),
'#default_value' => $this->settings['wrapper'],
);
$form['element'] = array(
'#type' => 'select',
'#title' => t('HTML element'),
'#default_value' => $this->settings['element'],
'#description' => t('Choose the HTML element to wrap around this item, e.g. H1, H2, etc.'),
'#states' => array(
'visible' => array(
':input[name="plugin_settings[' . $this->name . '][wrapper]"]' => array(
'checked' => TRUE,
),
),
),
'#options' => array(
'0' => t('<None>'),
'div' => 'DIV',
'span' => 'SPAN',
'h1' => 'H1',
'h2' => 'H2',
'h3' => 'H3',
'h4' => 'H4',
'h5' => 'H5',
'h6' => 'H6',
'p' => 'P',
'strong' => 'STRONG',
'em' => 'EM',
),
);
$form['css'] = array(
'#type' => 'checkbox',
'#title' => t('Add CSS classes to wrapper element'),
'#default_value' => $this->settings['css'],
'#states' => array(
'visible' => array(
':input[name="plugin_settings[' . $this->name . '][wrapper]"]' => array(
'checked' => TRUE,
),
),
),
);
$form['classes'] = array(
'#type' => 'textfield',
'#title' => t('CSS classes'),
'#default_value' => $this->settings['classes'],
'#description' => t('A comma separated list of CSS classes. Token replacement patterns are allowed.'),
'#maxlength' => 128,
'#states' => array(
'visible' => array(
':input[name="plugin_settings[' . $this->name . '][wrapper]"]' => array(
'checked' => TRUE,
),
':input[name="plugin_settings[' . $this->name . '][css]"]' => array(
'checked' => TRUE,
),
),
),
);
}