function _user_badges_build_image in User Badges 7
Same name and namespace in other branches
- 6.2 user_badges.module \_user_badges_build_image()
- 6 user_badges.module \_user_badges_build_image()
- 7.2 user_badges.module \_user_badges_build_image()
- 7.3 user_badges.module \_user_badges_build_image()
Helper function to produce badge image.
2 calls to _user_badges_build_image()
- theme_user_badge in ./
user_badges.module - Return html representation of a badge image (note: theme_image does the check_plaining)
- user_badges_roles_form in ./
user_badges.admin.inc - Form to associated badges with roles.
File
- ./
user_badges.module, line 1221 - @brief User Badges module file
Code
function _user_badges_build_image($badge) {
$style_name = variable_get('user_badges_imagecache', '');
$alt = check_plain($badge->name);
if (!isset($badge->class)) {
$badge->class = "badge badge-{$badge->bid} badge-" . drupal_html_class($badge->name);
}
if (file_valid_uri($badge->image)) {
$badge->image = file_create_url($badge->image);
}
$variables = array(
'style_name' => $style_name,
'path' => $badge->image,
'alt' => $alt,
'title' => $alt,
'attributes' => array(
'class' => array(
$badge->class,
),
),
);
$theme = $style_name ? 'image_style' : 'image';
$image = theme($theme, $variables);
return $image;
}