function LinkWidget::errorElement

Overrides WidgetBase::errorElement

File

core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php, line 486

Class

LinkWidget
Plugin implementation of the 'link' widget.

Namespace

Drupal\link\Plugin\Field\FieldWidget

Code

public function errorElement(array $element, ConstraintViolationInterface $violation, array $form, FormStateInterface $form_state) {
  $element = parent::errorElement($element, $violation, $form, $form_state);
  $property_path_array = explode('.', $violation->getPropertyPath());
  return $element === FALSE ? FALSE : $element[$property_path_array[1]];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.