diff --git a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php index 937491f..544e35b 100644 --- a/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php @@ -150,7 +150,7 @@ public static function validateUriElement($element, FormStateInterface $form_sta */ public static function validateTitleElement(&$element, FormStateInterface $form_state, $form) { if ($element['uri']['#value'] !== '' && $element['title']['#value'] === '') { - $element['title']['#required'] = TRUE; + //$element['title']['#required'] = TRUE; // We expect the field name placeholder value to be wrapped in t() here, // so it won't be escaped again as it's already marked safe. $form_state->setError($element['title'], t('@name field is required.', ['@name' => $element['title']['#title']])); @@ -223,6 +223,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen // settings cannot be saved otherwise. if (!$this->isDefaultValueWidget($form_state) && $this->getFieldSetting('title') == DRUPAL_REQUIRED) { $element['#element_validate'][] = [get_called_class(), 'validateTitleElement']; + $element['title']['#required'] = TRUE; } // Exposing the attributes array in the widget is left for alternate and more