You are here

protected static function ReferenceWidget::prepareElementValuesForValidation in Select (or other) 4.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldWidget/ReferenceWidget.php \Drupal\select_or_other\Plugin\Field\FieldWidget\ReferenceWidget::prepareElementValuesForValidation()

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/ReferenceWidget.php
Form element validation handler for select_or_other_reference elements.

File

src/Plugin/Field/FieldWidget/ReferenceWidget.php, line 71

Class

ReferenceWidget
Plugin implementation of the 'select_or_other_reference' widget.

Namespace

Drupal\select_or_other\Plugin\Field\FieldWidget

Code

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