function taxonomy_autocomplete_validate

Form element validate handler for taxonomy term autocomplete element.

1 string reference to 'taxonomy_autocomplete_validate'
TaxonomyAutocompleteWidget::formElement in drupal/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/field/widget/TaxonomyAutocompleteWidget.php
Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().

File

drupal/core/modules/taxonomy/taxonomy.module, line 1291
Enables the organization of content into categories.

Code

function taxonomy_autocomplete_validate($element, &$form_state) {

  // Split the values into an array.
  // @see Drupal\taxonomy\Plugin\field\widget\TaxonomyAutocompleteWidget:massageFormValues()
  $typed_terms = array();
  if ($tags = $element['#value']) {
    $typed_terms = drupal_explode_tags($tags);
  }
  form_set_value($element, $typed_terms, $form_state);
}