You are here

public function GridStackBase::getRandomizedId in GridStack 8.2

Returns a randomized ID.

File

src/Entity/GridStackBase.php, line 188

Class

GridStackBase
Defines the base class for GridStack configuration entity.

Namespace

Drupal\gridstack\Entity

Code

public function getRandomizedId($rand = 4) {
  $id = $this
    ->id();
  $names = strpos($id, '__') === FALSE ? explode("_", $id) : explode("__", $id);
  if (count($names) > 1) {
    array_pop($names);
  }
  return implode("__", $names) . '__' . $this
    ->randomize($rand);
}