You are here

public function SearchApiAbstractProcessor::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 SearchApiProcessorInterface::configurationForm

4 calls to SearchApiAbstractProcessor::configurationForm()
SearchApiHtmlFilter::configurationForm in includes/processor_html_filter.inc
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.
SearchApiPorterStemmer::configurationForm in includes/processor_stemmer.inc
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.
SearchApiStopWords::configurationForm in includes/processor_stopwords.inc
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.
SearchApiTokenizer::configurationForm in includes/processor_tokenizer.inc
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.
5 methods override SearchApiAbstractProcessor::configurationForm()
SearchApiHighlight::configurationForm in includes/processor_highlight.inc
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.
SearchApiHtmlFilter::configurationForm in includes/processor_html_filter.inc
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.
SearchApiPorterStemmer::configurationForm in includes/processor_stemmer.inc
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.
SearchApiStopWords::configurationForm in includes/processor_stopwords.inc
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.
SearchApiTokenizer::configurationForm in includes/processor_tokenizer.inc
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.

File

includes/processor.inc, line 165
Contains SearchApiProcessorInterface and SearchApiAbstractProcessor.

Class

SearchApiAbstractProcessor
Abstract processor implementation that provides an easy framework for only processing specific fields.

Code

public function configurationForm() {
  $form['#attached']['css'][] = drupal_get_path('module', 'search_api') . '/search_api.admin.css';
  $fields = $this->index
    ->getFields();
  $field_options = array();
  $default_fields = array();
  if (isset($this->options['fields'])) {
    $default_fields = drupal_map_assoc(array_keys($this->options['fields']));
  }
  foreach ($fields as $name => $field) {
    $field_options[$name] = check_plain($field['name']);
    if (!empty($default_fields[$name]) || !isset($this->options['fields']) && $this
      ->testField($name, $field)) {
      $default_fields[$name] = $name;
    }
  }
  $form['fields'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Fields to run on'),
    '#options' => $field_options,
    '#default_value' => $default_fields,
    '#attributes' => array(
      'class' => array(
        'search-api-checkboxes-list',
      ),
    ),
  );
  return $form;
}