function _user_badges_build_image in User Badges 7.3
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 user_badges.module \_user_badges_build_image()
- 7.2 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 1262 - @brief User Badges module file
Code
function _user_badges_build_image($badge) {
//Initialize the image style
$style_name = '';
//If this is a library image, then, style it according to the image style the user selected in the settings page
if (file_valid_uri($badge->image)) {
$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);
}
$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;
}