public static function WebformEntityReferenceSelectWidget::validateWebformEntityReferenceSelectWidget in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/Field/FieldWidget/WebformEntityReferenceSelectWidget.php \Drupal\webform\Plugin\Field\FieldWidget\WebformEntityReferenceSelectWidget::validateWebformEntityReferenceSelectWidget()
Webform element validation handler for entity_select elements.
File
- src/
Plugin/ Field/ FieldWidget/ WebformEntityReferenceSelectWidget.php, line 83
Class
- WebformEntityReferenceSelectWidget
- Plugin implementation of the 'webform_entity_reference_select' widget.
Namespace
Drupal\webform\Plugin\Field\FieldWidgetCode
public static function validateWebformEntityReferenceSelectWidget(&$element, FormStateInterface $form_state, &$complete_form) {
// Below prevents the below error.
// Fatal error: Call to a member function uuid() on a non-object in
// core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php.
$value = !empty($element['#value']) ? $element['#value'] : NULL;
$form_state
->setValueForElement($element, $value);
}