You are here

public function SearchApiPorterStemmer::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_stemmer.inc, line 23
Contains SearchApiPorterStemmer and SearchApiPorter2.

Class

SearchApiPorterStemmer
Stems words to their roots.

Code

public function configurationForm() {
  $form = parent::configurationForm();
  $args = array(
    '@algorithm' => url('http://snowball.tartarus.org/algorithms/english/stemmer.html'),
  );
  $form += array(
    'help' => array(
      '#markup' => '<p>' . t('Optionally, provide an exclusion list to override the stemmer algorithm. (<a href="@algorithm">Read about the algorithm</a>.)', $args) . '</p>',
    ),
    'exceptions' => array(
      '#type' => 'textarea',
      '#title' => t('Exceptions'),
      '#description' => t('Enter exceptions in the form of WORD=STEM, where "WORD" is the term entered and "STEM" is the resulting stem. List each exception on a separate line.'),
      '#default_value' => "texan=texa",
    ),
  );
  if (!empty($this->options['exceptions'])) {
    $form['exceptions']['#default_value'] = $this->options['exceptions'];
  }
  return $form;
}