You are here

public static function Html::getClass in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/Component/Utility/Html.php \Drupal\Component\Utility\Html::getClass()

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

string $class: The class name to clean.

Return value

string The cleaned class name.

File

lib/Drupal/Component/Utility/Html.php, line 56
Contains \Drupal\Component\Utility\Html.

Class

Html
Provides DOMDocument helpers for parsing and serializing HTML strings.

Namespace

Drupal\Component\Utility

Code

public static function getClass($class) {
  if (!isset(static::$classes[$class])) {
    static::$classes[$class] = static::cleanCssIdentifier(Unicode::strtolower($class));
  }
  return static::$classes[$class];
}