You are here

public static function Blazy::getHtmlId in Blazy 8.2

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

Returns the trusted HTML ID of a single instance.

4 calls to Blazy::getHtmlId()
BlazyFilter::buildSettings in src/Plugin/Filter/BlazyFilter.php
Returns the main settings.
BlazyFormatter::buildSettings in src/BlazyFormatter.php
Modifies the field formatter settings inherited by child elements.
BlazyManagerBase::getCacheMetadata in src/BlazyManagerBase.php
Return the cache metadata common for all blazy-related modules.
BlazyStyleBaseTrait::buildSettings in src/Dejavu/BlazyStyleBaseTrait.php
Provides commons settings for the style plugins.

File

src/Blazy.php, line 434

Class

Blazy
Provides common blazy utility static methods.

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 Html::getId($id);
}