W3cubDocs

/Drupal 8

public static function Html::getClass

public static Html::getClass($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

string $class: The class name to clean.

Return value

string The cleaned class name.

File

core/lib/Drupal/Component/Utility/Html.php, line 51

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];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Html.php/function/Html::getClass/8.1.x