Commit 5e4fb4fc authored by webchick's avatar webchick

Issue #2154589 by Wim Leers: Edit breaks when the entity title is promoted to...

Issue #2154589 by Wim Leers: Edit breaks when the entity title is promoted to the page title (discovered by backporting).
parent 5cc0a0ce
......@@ -203,8 +203,15 @@ function processField (fieldElement) {
var entityID = extractEntityID(fieldID);
// Figure out the instance ID by looking at the ancestor [data-edit-entity-id]
// element's data-edit-entity-instance-id attribute.
var entityInstanceID = $(fieldElement)
.closest('[data-edit-entity-id="' + entityID + '"]')
var entityElementSelector = '[data-edit-entity-id="' + entityID + '"]';
var entityElement = $(fieldElement).closest(entityElementSelector);
// In the case of a full entity view page, the entity title is rendered
// outside of "the entity DOM node": it's rendered as the page title. So in
// this case, we must find the entity in the mandatory "content" region.
if (entityElement.length === 0) {
entityElement = $('.region-content').find(entityElementSelector);
}
var entityInstanceID = entityElement
.get(0)
.getAttribute('data-edit-entity-instance-id');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment