You are here

protected static function ReferenceWidget::prepareElementValuesForValidation in Select (or other) 8.3

Helper method which prepares element values for validation.

EntityAutocomplete::validateEntityAutocomplete expects a string when validating taxonomy terms.

Parameters

array $element: The element to prepare.

1 call to ReferenceWidget::prepareElementValuesForValidation()
ReferenceWidget::validateReferenceWidget in src/Plugin/Field/FieldWidget/EntityReference/ReferenceWidget.php
Form element validation handler for select_or_other_reference elements.

File

src/Plugin/Field/FieldWidget/EntityReference/ReferenceWidget.php, line 42
Contains \Drupal\select_or_other\Plugin\Field\FieldWidget\EntityReference\ReferenceWidget.

Class

ReferenceWidget
Plugin implementation of the 'select_or_other_reference' widget.

Namespace

Drupal\select_or_other\Plugin\Field\FieldWidget\EntityReference

Code

protected static function prepareElementValuesForValidation(array &$element) {
  if ($element['#tags']) {
    $element['#value'] = Tags::implode($element['#value']);
  }
}