1 common.inc backdrop_html_class($class)

Prepares a string for use as a valid class name.

Do not pass one string containing multiple classes as they will be incorrectly concatenated with dashes, i.e. "one two" will become "one-two".

Parameters

$class: The class name to clean.

Return value

The cleaned class name.

File

core/includes/common.inc, line 4166
Common functions that many Backdrop modules will need to reference.

Code

function backdrop_html_class($class) {
  // The output of this function will never change, so this uses a normal
  // static instead of backdrop_static().
  static $classes = array();

  if (!isset($classes[$class])) {
    $classes[$class] = backdrop_clean_css_identifier(backdrop_strtolower($class));
  }
  return $classes[$class];
}