$form_state->setError($element['uri'],t('The @uri field is required when the @title field is specified.',['@title'=>$element['title']['#title'],'@uri'=>$element['uri']['#title']]));
}
}
/**
* {@inheritdoc}
*/
...
...
@@ -222,8 +233,12 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
// Post-process the title field to make it conditionally required if URL is
// non-empty. Omit the validation on the field edit form, since the field
// settings cannot be saved otherwise.
//
// Validate that title field is filled out (regardless of uri) when it is a