You are here

function _user_badges_class in User Badges 6.2

Same name and namespace in other branches
  1. 6 user_badges.module \_user_badges_class()

Helper function for building badge class names. I was originally using form_clean_id, but it is not secure.

Parameters

$badge - the object describing the badge.:

Return value

string containing the class name.

5 calls to _user_badges_class()
theme_user_badge in ./user_badges.module
Return html representation of a badge image (note: theme_image does the check_plaining)
user_badges_badgelist_form in ./user_badges.admin.inc
Form builder; list of badges
user_badges_get_badges in ./user_badges.module
Return array of user badges where keys are badge ids (bid) and values are object containing badge info.
user_badges_user in ./user_badges.module
Implements hook_user().
_user_badges_build_image in ./user_badges.module
Helper function to produce badge image.

File

./user_badges.module, line 322
@brief User Badges module file

Code

function _user_badges_class($badge) {

  // Doing separate lines makes changing the algorithm easier.
  $class = $badge->name;
  $class = strip_tags($class, '');
  $class = drupal_strtolower($class);
  $class = str_replace(array(
    '"',
    "'",
  ), '', $class);
  $class = str_replace(array(
    '_',
    ' ',
  ), '-', $class);
  return $class;
}