ECA Content module breaks core workspaces
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3543248. --> Reported by: [freelock](https://www.drupal.org/user/313537) Related to !581 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When the ECA Content module is enabled, along with the core Workspaces module, new revisions to content are not saved to the workspace, nor made active anywhere.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Enable workspaces and ECA content.</p> <p>Change to a new workspace (for example, "stage").</p> <p>Edit an existing node, and save.</p> <p>Result: a new revision is created, but the active revision remains as the original one. The changed node is not added to the workspace, and you cannot switch to the new revision without switching back to the default revision.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>The code that breaks this functionality is in modules/content/src/HookHandler.php:</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp; </span><span style="color: #007700">public function </span><span style="color: #0000BB">update</span><span style="color: #007700">(</span><span style="color: #0000BB">EntityInterface $entity</span><span style="color: #007700">): </span><span style="color: #0000BB">void </span><span style="color: #007700">{<br>&nbsp;&nbsp;&nbsp; if (</span><span style="color: #0000BB">$entity </span><span style="color: #007700">instanceof </span><span style="color: #0000BB">ContentEntityInterface</span><span style="color: #007700">) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (</span><span style="color: #0000BB">$entity</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getEntityType</span><span style="color: #007700">()-&gt;</span><span style="color: #0000BB">hasKey</span><span style="color: #007700">(</span><span style="color: #DD0000">'revision'</span><span style="color: #007700">)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #FF8000">// Make sure the subsequent actions will not create another revision<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // when they save this entity again.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$entity</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setNewRevision</span><span style="color: #007700">(</span><span style="color: #0000BB">FALSE</span><span style="color: #007700">);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$entity</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">updateLoadedRevisionId</span><span style="color: #007700">();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">triggerEvent</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">dispatchFromPlugin</span><span style="color: #007700">(</span><span style="color: #DD0000">'content_entity:update'</span><span style="color: #007700">, </span><span style="color: #0000BB">$entity</span><span style="color: #007700">, </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">entityTypes</span><span style="color: #007700">);<br>&nbsp;&nbsp;&nbsp; }<br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <p>... The workspaces update hook compares the $entity-&gt;getLoadedRevisionId() with $entity-&gt;getRevisionId(), and if they are the same, it skips the rest of the workspace logic -- and this code makes them the same, before the Workspaces hook runs.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>Identify an appropriate solution, and implement.</p> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue