You are here

public function CurrentSearchItemText::settingsForm in Facet API 7

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

Implements CurrentSearchItem::settingsForm().

Overrides CurrentSearchItem::settingsForm

File

contrib/current_search/plugins/current_search/item_text.inc, line 58
The text current search item plugin class.

Class

CurrentSearchItemText
Current search item plugin that displays text configured by the user.

Code

public function settingsForm(&$form, &$form_state) {
  $form['text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text'),
    '#default_value' => $this->settings['text'],
    '#maxlength' => 255,
    '#description' => t('Custom text displayed in the text box. Token replacement patterns are allowed.'),
  );
  $form['plural'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add plural text'),
    '#default_value' => $this->settings['plural'],
  );
  $form['text_plural'] = array(
    '#type' => 'textfield',
    '#title' => t('Plural text'),
    '#default_value' => $this->settings['text_plural'],
    '#maxlength' => 255,
    '#description' => t('Plural equivalent of the custom text displayed in the text box. Token replacement patterns are allowed.'),
    '#states' => array(
      'visible' => array(
        ':input[name="plugin_settings[' . $this->name . '][plural]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['plural_condition'] = array(
    '#type' => 'select',
    '#title' => t('Plural condition'),
    '#options' => array(
      'facetapi_results:result-count' => t('Total number of results'),
      'facetapi_results:page-number' => t('Page number'),
      'facetapi_results:page-limit' => t('Results per page'),
    ),
    '#default_value' => $this->settings['plural_condition'],
    '#description' => t('The condition that determines whether the singular or plural string is used.'),
    '#states' => array(
      'visible' => array(
        ':input[name="plugin_settings[' . $this->name . '][plural]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );

  // Adds HTML wrapper elements.
  $this
    ->wrapperForm($form, $form_state);

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