You are here

public static function GridStack::getHtmlId in GridStack 8

Returns the trusted HTML ID of a single gridstack instance.

3 calls to GridStack::getHtmlId()
GridStackCrudTest::testGridStackCrud in tests/src/Kernel/GridStackCrudTest.php
Tests CRUD operations for GridStack optionsets.
GridStackManager::build in src/GridStackManager.php
Returns a cacheable renderable array of a single gridstack instance.
template_preprocess_gridstack in templates/gridstack.theme.inc
Prepares variables for gridstack.html.twig templates.

File

src/Entity/GridStack.php, line 429

Class

GridStack
Defines the GridStack configuration entity.

Namespace

Drupal\gridstack\Entity

Code

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

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