function theme_user_badge in User Badges 7.2
Same name and namespace in other branches
- 5 user_badges.module \theme_user_badge()
- 6.2 user_badges.module \theme_user_badge()
- 6 user_badges.module \theme_user_badge()
- 7 user_badges.module \theme_user_badge()
- 7.3 user_badges.module \theme_user_badge()
Return html representation of a badge image (note: theme_image does the check_plaining)
12 theme calls to theme_user_badge()
- user_badges_add_badge_action_form in ./
user_badges.actions.inc - @todo Please document this function.
- user_badges_badgelist_form in ./
user_badges.admin.inc - Form builder; list of badges
- user_badges_badge_autocomplete in ./
user_badges.module - Menu callback; Retrieve a JSON object containing autocomplete suggestions for badges
- user_badges_block_view in ./
user_badges.module - Implements hook_block_view().
- user_badges_change_form in ./
user_badges.module - Form to change badges of a user
File
- ./
user_badges.module, line 1169 - @brief User Badges module file
Code
function theme_user_badge($variables) {
$badge = $variables['badge'];
$image = _user_badges_build_image($badge);
// We don't link the badge if there is no link and no default,
// or if the default is overridden.
if ($badge->href == '' && !variable_get('user_badges_defaulthref', '') || drupal_strtolower($badge->href) == '<none>') {
return $image;
}
else {
$href = $badge->href ? $badge->href : variable_get('user_badges_defaulthref', '');
// Implement token replacement.
if (module_exists('token')) {
// $href = token_replace($href, array('userbadge' => $badge, 'user' => $account));
}
$pieces = parse_url($href);
$pieces['html'] = TRUE;
$pieces['path'] = isset($pieces['path']) ? $pieces['path'] : '';
if (isset($pieces['scheme'])) {
$pieces['path'] = $pieces['scheme'] . '://' . $pieces['host'] . $pieces['path'];
}
return l($image, $pieces['path'], $pieces);
}
}