Skip to content
Snippets Groups Projects
Commit 95f3407a authored by Justin Toupin's avatar Justin Toupin
Browse files

Generate random, unique id and store in protected variable.

parent b68c78b4
No related branches found
No related tags found
1 merge request!110Issue #3279438: ID for storage not unique
......@@ -53,6 +53,13 @@ class LayoutParagraphsLayout implements ThirdPartySettingsInterface {
*/
protected $settings;
/**
* The layout ID.
*
* @var string
*/
protected $id;
/**
* Class constructor.
*
......@@ -76,11 +83,10 @@ class LayoutParagraphsLayout implements ThirdPartySettingsInterface {
* A unique id.
*/
public function id() {
$uuid = $this->getEntity()->uuid();
$langcode = $this->getEntity()->language()->getId();
$field_name = $this->getFieldName();
$id = Crypt::hashBase64($uuid . $langcode . $field_name);
return $id;
if (empty($this->id)) {
$this->id = bin2hex(random_bytes(16));
}
return $this->id;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment