You are here

public function CurrentSearchItemActive::settingsForm in Facet API 7

Same name and namespace in other branches
  1. 6.3 contrib/current_search/plugins/current_search/item_active.inc \CurrentSearchItemActive::settingsForm()
  2. 7.2 contrib/current_search/plugins/current_search/item_active.inc \CurrentSearchItemActive::settingsForm()

Implements CurrentSearchItem::settingsForm().

Overrides CurrentSearchItem::settingsForm

File

contrib/current_search/plugins/current_search/item_active.inc, line 129
The active current search item plugin class.

Class

CurrentSearchItemActive
Current search item plugin that displays the active facet items.

Code

public function settingsForm(&$form, &$form_state) {
  $form['pattern'] = array(
    '#type' => 'textfield',
    '#title' => t('Pattern'),
    '#default_value' => $this->settings['pattern'],
    '#description' => t('The pattern used to render active items in the list. Token replacement patterns are allowed.'),
    '#maxlength' => 255,
  );
  $form['keys'] = array(
    '#type' => 'checkbox',
    '#title' => t('Append the keywords passed by the user to the list'),
    '#default_value' => isset($this->settings['keys']) ? $this->settings['keys'] : TRUE,
  );
  $form['keys_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display the keywords as a link to remove them from the search'),
    '#default_value' => isset($this->settings['keys_link']) ? $this->settings['keys_link'] : TRUE,
    '#states' => array(
      'visible' => array(
        ':input[name="plugin_settings[' . $this->name . '][keys]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['keys_param'] = array(
    '#type' => 'textfield',
    '#title' => t('Keywords parameter'),
    '#default_value' => isset($this->settings['keys_param']) ? $this->settings['keys_param'] : '',
    '#description' => t('Provide the URL parameter used for search keywords. For example, enter "query" if the search URL is "search/books?query={keywords}". If no parameter is provided, it is assumed that keywords are the last part of the path.'),
    '#states' => array(
      'visible' => array(
        ':input[name="plugin_settings[' . $this->name . '][keys]"]' => array(
          'checked' => TRUE,
        ),
        ':input[name="plugin_settings[' . $this->name . '][keys_link]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['css'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add CSS classes to wrapper element'),
    '#default_value' => $this->settings['css'],
  );
  $form['classes'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS classes'),
    '#default_value' => $this->settings['classes'],
    '#description' => t('A comma separated list of CSS classes.'),
    '#maxlength' => 128,
    '#states' => array(
      'visible' => array(
        ':input[name="plugin_settings[' . $this->name . '][css]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['nofollow'] = array(
    '#type' => 'checkbox',
    '#title' => t('Prevent crawlers from following active item links'),
    '#default_value' => $this->settings['nofollow'],
    '#description' => t('Add the <code>rel="nofollow"</code> attribute to active item links to maximize SEO by preventing crawlers from indexing duplicate content and getting stuck in loops.'),
  );

  // Adds token tree.
  $form['tokens'] = $this
    ->getTokenTree(array(
    'facetapi_active',
  ));
}