function drupal_html_class
7.x common.inc | drupal_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.
12 calls to drupal_html_class()
- contextual_pre_render_links in drupal-7.x/
modules/ contextual/ contextual.module - Build a renderable array for contextual links.
- dblog_overview in drupal-7.x/
modules/ dblog/ dblog.admin.inc - Page callback: Displays a listing of database log messages.
- DrupalHTMLIdentifierTestCase::testDrupalHTMLClass in drupal-7.x/
modules/ simpletest/ tests/ common.test - Tests that drupal_html_class() cleans the class name properly.
- drupal_region_class in drupal-7.x/
includes/ common.inc - Provides a standard HTML class name that identifies a page region.
- field_default_form in drupal-7.x/
modules/ field/ field.form.inc - Creates a form element for a field and can populate it with a default value.
File
- drupal-7.x/
includes/ common.inc, line 3841 - Common functions that many Drupal modules will need to reference.
Code
function drupal_html_class($class) {
// The output of this function will never change, so this uses a normal
// static instead of drupal_static().
static $classes = array();
if (!isset($classes[$class])) {
$classes[$class] = drupal_clean_css_identifier(drupal_strtolower($class));
}
return $classes[$class];
}