return;
} $error_links =
[];
$errors =
$form_state->
getErrors();
// Loop through all form errors and check if we need to display a link.
foreach ($errors as $name =>
$error) { $form_element = FormElementHelper::
getElementByName($name,
$form);
$title = FormElementHelper::
getElementTitle($form_element);
// Only show links to erroneous elements that are visible.
$is_visible_element = Element::
isVisibleElement($form_element);
// Only show links for elements that have a title themselves or have
// children with a title.
$has_title = !
empty($title);
// Only show links for elements with an ID.
$has_id = !
empty($form_element['#id'
]);
// Do not show links to elements with suppressed messages. Most often
// their parent element is used for inline errors.
if (!
empty($form_element['#error_no_message'
])) { unset($errors[$name]);
}