- Issue created by @mykola dolynskyi
- Merge request !145Issue fix #3543315 by mykola dolynskyi: revision_id is submitted as empty if... β (Open) created by mykola dolynskyi
inline_entity_form + layout_builder + entity_reference_revisions
Fields are revisionable, new revision is on.
So once you opening existing whatever (block in our case which is represented by entity_reference_revisions)
if you click any "update" button - all is OK.
But if you click "Cancel" results will go to upper conxtext entity_reference_revisions with ['target_revision_id'] === ''.
And this is because of modules/contrib/inline_entity_form/src/Element/InlineEntityForm.php::processEntityForm() having a lines
// Handle revisioning if the entity supports it.
if ($entity_type->isRevisionable() && $entity_form['#revision']) {
$entity_form['#entity']->setNewRevision($entity_form['#revision']);
which enforce ['#entity']['revision_id'] to be erased at the begining of lifecycle where process where form is build.
Unlike "update" buttons "cancel" does not invoke
$inline_form_handler->save($entity_form['#entity']);
which populates empty revision_id with new value, so page gets broken.
We have tested this bug down to v1 of inline_entity_form till 2023 - it is present in all versions.
Described above +
not to $entity_form['#entity']->setNewRevision($entity_form['#revision']); if triggering_element is 'cancel'.
Thanks Mindaugas Svirskas (AKA
@mindaugas-svirskas β
AKA
@msfranklydk β
) for suggesting and testing this simple and working idea
none.
none.
none.
none.
Needs review
3.0
Code