diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-11-12 07:00:48 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-11-12 07:00:48 +0000 |
commit | 2387e71f6d163f88ab3194cec0159afa858f03aa (patch) | |
tree | 928aabdb95b47020b4d194692411a74a3377c93e /includes | |
parent | 036dc1d14033b2e76e0a114e342de6cb9d205fa8 (diff) | |
download | brdo-2387e71f6d163f88ab3194cec0159afa858f03aa.tar.gz brdo-2387e71f6d163f88ab3194cec0159afa858f03aa.tar.bz2 |
- Patch #614444 by scor, effulgentsia: more consistent RDFa logic for username.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/theme.inc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 9cb913e14..84812e6c8 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -2003,7 +2003,10 @@ function template_preprocess_username(&$variables) { $variables['link_path'] = 'user/' . $variables['uid']; } elseif (!empty($account->homepage)) { - $variables['link_attributes'] = array('rel' => 'nofollow'); + // Like the 'class' attribute, the 'rel' attribute can hold a + // space-separated set of values, so initialize it as an array to make it + // easier for other preprocess functions to append to it. + $variables['link_attributes'] = array('rel' => array('nofollow')); $variables['link_path'] = $account->homepage; $variables['homepage'] = $account->homepage; } @@ -2023,7 +2026,14 @@ function template_process_username(&$variables) { // This is done in the process phase so that attributes may be added by // modules or the theme during the preprocess phase. if (isset($variables['link_path'])) { - $variables['link_options']['attributes'] = $variables['link_attributes'] + $variables['attributes_array']; + // $variables['attributes_array'] contains attributes that should be applied + // regardless of whether a link is being rendered or not. + // $variables['link_attributes'] contains attributes that should only be + // applied if a link is being rendered. Preprocess functions are encouraged + // to use the former unless they want to add attributes on the link only. + // If a link is being rendered, these need to be merged. Some attributes are + // themselves arrays, so the merging needs to be recursive. + $variables['link_options']['attributes'] = array_merge_recursive($variables['link_attributes'], $variables['attributes_array']); } } |