You are here

public function CurrentSearchItem::wrapperForm in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 contrib/current_search/plugins/current_search/item.inc \CurrentSearchItem::wrapperForm()
  2. 7 contrib/current_search/plugins/current_search/item.inc \CurrentSearchItem::wrapperForm()

Returns "wrapper HTML" form elements.

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 106
Current search plugin base class.

Class

CurrentSearchItem
Base class for 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,
        ),
      ),
    ),
  );
}