You are here

public function SearchApiAlterAddCombined::configurationFormValidate in Search API Combined Fields 7

Implements SearchApiAlterCallbackInterface::configurationFormValidate().

Overrides SearchApiAbstractAlterCallback::configurationFormValidate

File

./callback_add_combined.inc, line 110

Class

SearchApiAlterAddCombined
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) {
    $fields = $values['fields'][$name]['fields'] = array_values(array_filter($field['fields']));
    unset($values['fields'][$name]['actions']);
    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.'));
    }
  }
}