diff --git a/core/lib/Drupal/Core/Utility/LinkGenerator.php b/core/lib/Drupal/Core/Utility/LinkGenerator.php index cfe0d19d13..89fce73d5b 100644 --- a/core/lib/Drupal/Core/Utility/LinkGenerator.php +++ b/core/lib/Drupal/Core/Utility/LinkGenerator.php @@ -157,7 +157,9 @@ public function generate($text, Url $url) { // Move attributes out of options since generateFromRoute() doesn't need // them. Make sure the "href" comes first for testing purposes. - $attributes = ['href' => ''] + $variables['options']['attributes']; + if (is_array($variables['options']['attributes'])) { + $attributes = ['href' => ''] + $variables['options']['attributes']; + } unset($variables['options']['attributes']); $url->setOptions($variables['options']);