You are here

public static function Blazy::getHtmlId in Blazy 7

Same name and namespace in other branches
  1. 8.2 src/Blazy.php \Drupal\blazy\Blazy::getHtmlId()
  2. 8 src/Blazy.php \Drupal\blazy\Blazy::getHtmlId()

Returns the trusted HTML ID of a single instance.

3 calls to Blazy::getHtmlId()
BlazyFormatter::buildSettings in src/BlazyFormatter.php
BlazyStyleBaseTrait::buildSettings in src/Dejavu/BlazyStyleBaseTrait.php
Provides commons settings for the style plugins.
BlazyTest::testNamespace in tests/Blazy.test
Tests Blazy PSR-4.

File

src/Blazy.php, line 271

Class

Blazy
Implements BlazyInterface.

Namespace

Drupal\blazy

Code

public static function getHtmlId($string = 'blazy', $id = '') {
  if (!isset(static::$blazyId)) {
    static::$blazyId = 0;
  }

  // Do not use dynamic Html::getUniqueId, otherwise broken AJAX.
  $id = empty($id) ? $string . '-' . ++static::$blazyId : $id;
  return trim(str_replace('_', '-', strip_tags($id)));
}