You are here

public function SearchApiFederatedSolrField::configurationFormValidate in Search API Federated Solr 7.2

Same name and namespace in other branches
  1. 7.3 src/SearchApiFederatedSolrField.php \SearchApiFederatedSolrField::configurationFormValidate()
  2. 7 src/SearchApiFederatedSolrField.php \SearchApiFederatedSolrField::configurationFormValidate()

Implements SearchApiAlterCallbackInterface::configurationFormValidate().

Overrides SearchApiAbstractAlterCallback::configurationFormValidate

File

src/SearchApiFederatedSolrField.php, line 147

Class

SearchApiFederatedSolrField

Code

public function configurationFormValidate(array $form, array &$values, array &$form_state) {
  parent::configurationFormValidate($form, $values, $form_state);
  if (isset($values['fields'])) {
    foreach ($values['fields'] as $key => $field) {
      if (preg_match('/^[0-9]|[^a-z0-9_]/i', $field['machine_name'])) {
        $name = "callbacks][federated_field][settings][fields][{$key}][machine_name";
        form_set_error($name, 'Federated field machine names must consist of alphanumeric or underscore characters only and not start with a digit.');
      }
    }
  }
}