public function SearchApiViewsHandlerFilterFulltext::options_form in Search API 7
Extend the options form a bit.
Overrides views_handler_filter::options_form
File
- contrib/
search_api_views/ includes/ handler_filter_fulltext.inc, line 50 - Contains SearchApiViewsHandlerFilterFulltext.
Class
- SearchApiViewsHandlerFilterFulltext
- Views filter handler class for handling fulltext fields.
Code
public function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$form['mode'] = array(
'#title' => t('Use as'),
'#type' => 'radios',
'#options' => array(
'keys' => t('Search keys – multiple words will be split and the filter will influence relevance. You can change how search keys are parsed under "Advanced" > "Query settings".'),
'filter' => t("Search filter – use as a single phrase that restricts the result set but doesn't influence relevance."),
),
'#default_value' => $this->options['mode'],
);
$fields = $this
->getFulltextFields();
if (!empty($fields)) {
$form['fields'] = array(
'#type' => 'select',
'#title' => t('Searched fields'),
'#description' => t('Select the fields that will be searched. If no fields are selected, all available fulltext fields will be searched.'),
'#options' => $fields,
'#size' => min(4, count($fields)),
'#multiple' => TRUE,
'#default_value' => $this->options['fields'],
);
}
else {
$form['fields'] = array(
'#type' => 'value',
'#value' => array(),
);
}
if (isset($form['expose'])) {
$form['expose']['#weight'] = -5;
}
$form['min_length'] = array(
'#title' => t('Minimum keyword length'),
'#description' => t('Minimum length of each word in the search keys. Leave empty to allow all words.'),
'#type' => 'textfield',
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => $this->options['min_length'],
);
}