diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 51b1099..68dcf5a 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -796,7 +796,7 @@ function template_preprocess_username(&$variables) { // We do not want the l() function to check_plain() a second time. $variables['link_options']['html'] = TRUE; // Set a default class. - $variables['attributes'] = new Attribute(array('class' => array('username'))); + $variables['attributes'] = array('class' => array('username')); } /** @@ -819,8 +819,7 @@ function template_process_username(&$variables) { // This purposefully does not use // \Drupal\Component\Utility\NestedArray::mergeDeep() for performance // reasons, since it is potentially called very often. - $attributes = (array) $variables['attributes']; - $variables['link_options']['attributes'] = new Attribute(array_merge_recursive($variables['link_attributes'], $attributes)); + $variables['link_options']['attributes'] = new Attribute(array_merge_recursive($variables['link_attributes'], $variables['attributes'])); $variables['link'] = array( '#theme' => 'link', '#text' => $variables['name'] . $variables['extra'], @@ -828,6 +827,8 @@ function template_process_username(&$variables) { '#options' => $variables['link_options'], ); } + + $variables['attributes'] = new Attribute($variables['attributes']); } /**