You are here

public function SearchApiStopWords::configurationForm in Search API 7

Display a form for configuring this processor. Since forcing users to specify options for disabled processors makes no sense, none of the form elements should have the '#required' attribute set.

Return value

array A form array for configuring this processor, or FALSE if no configuration is possible.

Overrides SearchApiAbstractProcessor::configurationForm

File

includes/processor_stopwords.inc, line 20
Contains SearchApiStopWords.

Class

SearchApiStopWords
Processor for removing stopwords from index and search terms.

Code

public function configurationForm() {
  $form = parent::configurationForm();
  $form += array(
    'help' => array(
      '#markup' => '<p>' . t('Provide a stopwords file or enter the words in this form. If you do both, both will be used. Read about !stopwords.', array(
        '!stopwords' => l(t('stop words'), "http://en.wikipedia.org/wiki/Stop_words"),
      )) . '</p>',
    ),
    'file' => array(
      '#type' => 'textfield',
      '#title' => t('Stopwords file'),
      '#description' => t('This must be a stream-type description like <code>public://stopwords/stopwords.txt</code> or <code>http://example.com/stopwords.txt</code> or <code>private://stopwords.txt</code>.'),
    ),
    'stopwords' => array(
      '#type' => 'textarea',
      '#title' => t('Stopwords'),
      '#description' => t('Enter a space and/or linebreak separated list of stopwords that will be removed from content before it is indexed and from search terms before searching.'),
      '#default_value' => t("but\ndid\nthe this that those\netc"),
    ),
  );
  if (!empty($this->options)) {
    $form['file']['#default_value'] = $this->options['file'];
    $form['stopwords']['#default_value'] = $this->options['stopwords'];
  }
  return $form;
}