We are having a problem where panelized nodes with IPE enabled sporadically become "locked" and can no longer be edited (or more specifically saved). When you try to save (from the node edit tab), you get the error:
The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.
Again, this error occurs when you try to save the node from the "edit" tab (e.g. trying to change the title, author, or workbench state). Oddly, you can still make changes using IPE and save the node using IPE.
This only happens on panelized nodes with IPE enabled, which leads us to strongly suspect that Panelizer and/or IPE are involved.
We don't know how to reproduce this error from scratch or how to "clear" it; once it appears on a node, that node is locked forever. The only workaround right now is to completely abandon the node, and manually duplicate it. Disabling workbench on the content type might also help.
We first saw this issue around the time that we upgraded to Lightning 1.00-rc3, although I doubt it's directly caused by Lightning or this release.
Comment | File | Size | Author |
---|---|---|---|
#3 | panelizer-update-changed.patch | 831 bytes | samuel.mortenson |
|
Comments
Comment #2
Dane Powell CreditAttribution: Dane Powell at Acquia commentedI have figured out exactly how to reproduce this on a fresh Lightning install... it's an interaction between the IPE tempstore and Workbench. This may seem convoluted, but it's actually very easy for content editors to accidentally do something like this:
Notice at this point that the changed time of the latest revision is actually _older_ than that of the published revision, which is what causes this error. In fact, the changed time of the latest revision matches the changed time of the very first draft of the node, where you initially started to use IPE to edit the node.
Maybe IPE just needs to set the "changed" date dynamically when the node is saved, rather than storing this changed time in the tempstore as it seems to currently do?
Comment #3
samuel.mortensonI was able to replicate the issue, but not consistently. At any rate, it looks like Entity Types that implement the EntityChangedInterface class require the changed time to be updated before the Entity is saved, which is typically done in the ContentEntityForm. Since Panelizer is updating nodes programmatically, this requirement is never met.
Can we test to see if this patch fixes the issue? If so, we can move the issue to the Panelizer queue.
Comment #4
Dane Powell CreditAttribution: Dane Powell at Acquia commentedThanks a lot Sam, that patch does seem to prevent nodes from becoming locked (following the testing steps above).
In order to fix existing nodes affected by this bug, after applying the patch you just have to edit and save a locked node once using IPE in order to clear the lock.
Moving to Panelizer queue.
Comment #5
Dane Powell CreditAttribution: Dane Powell at Acquia commentedComment #6
samuel.mortensonComment #7
dsnopekCould this be
$entity->getEntityType() instanceof EntityChangedInterface
instead? That's more inline with the way we usually check this in other Drupal code.Comment #8
samuel.mortensonI based the check on how core was doing it: http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/Entity/Conte...
But if
instanceof
is equivalent, I can change that. From a quick search the only difference I see is this: http://www.java2s.com/Code/Php/Language-Basics/Differencebetweeninstance..., which would never affect this logic.Comment #9
dsnopekEr, ok, I just looked into this more and it has to be
->isSubclassOf()
, sorry!That method is actually checking if the entity class (not the entity type class itself) is a subclass of the given class/interface. So, I think this is fine!
This would be better with tests, but it sounds like there was trouble reproducing it, so that might not be practical...
Comment #10
DamienMcKenna+1 for needing tests to confirm this bug no longer exists with the patch applied, and tests-only patch that confirms the bug exists.
Comment #12
DamienMcKennaAfter reviewing the issue again, I've decided to commit this, we can work on tests later.