Closed (fixed)
Project:
Entity Embed
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 May 2014 at 15:57 UTC
Updated:
31 May 2014 at 08:30 UTC
Jump to comment: Most recent
data-entity-id currently overrides data-entity-uuid if both present for a given node:
// from EntityEmbedFilter::process()
if ($node->hasAttribute('data-entity-uuid')) {
// ....
}
if ($node->hasAttribute('data-entity-id')) {
//....
}
Since we encourage UUID usage we probably want the opposite. Something like this:
// from EntityEmbedFilter::process()
if ($node->hasAttribute('data-entity-uuid')) {
// ....
}
elseif ($node->hasAttribute('data-entity-id')) {
//....
}
Also, UUID is being added into DOM if ID is being used. AFAIK this is not actually saved, so I don't see real point in doing that. Can we simply kill that part of the code?
// Add the entity UUID.
if ($entity && $uuid = $entity->uuid()) {
$node->setAttribute('data-entity-uuid', $uuid);
}
Comments
Comment #1
cs_shadow commentedIn my PR (https://github.com/drupal-media/entity_embed/pull/7/), data UUID is given preference over ID as mentioned above.
Reg. the 2nd point, the UUID is actually appended to the parent DOM node beacuse the changes actually get saved. Hence, its not required to kill that code.
Comment #2
cs_shadow commentedComment #3
slashrsm commentedLet's split PRs as also mentioned in #2269135: Should embedded entity replace existing content.
Comment #4
cs_shadow commentedSplitted PRs, #7 and #8.
Comment #5
slashrsm commentedMerged.