public function SearchApiAlterAddAggregation::configurationFormValidate in Search API 7
Implements SearchApiAlterCallbackInterface::configurationFormValidate().
Overrides SearchApiAbstractAlterCallback::configurationFormValidate
File
- includes/
callback_add_aggregation.inc, line 148 - Contains SearchApiAlterAddAggregation.
Class
- SearchApiAlterAddAggregation
- Search API data alteration callback that adds an URL field for all items.
Code
public function configurationFormValidate(array $form, array &$values, array &$form_state) {
unset($values['actions']);
if (empty($values['fields'])) {
return;
}
foreach ($values['fields'] as $name => $field) {
unset($values['fields'][$name]['actions']);
$fields = $values['fields'][$name]['fields'] = array_values(array_filter($field['fields']));
if ($field['name'] && !$fields) {
form_error($form['fields'][$name]['fields'], t('You have to select at least one field to aggregate. If you want to remove an aggregated field, please delete its name.'));
}
$values['fields'][$name]['separator'] = stripcslashes($field['separator']);
}
}