Skip to content

Commit 9325503

Browse files
committed
Ensure patch always creates a new revision
1 parent 3cd6f43 commit 9325503

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Plugin/Action/StrawberryfieldJsonPatch.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ public function execute($entity = NULL) {
281281

282282
]);
283283
if (!$this->configuration['simulate']) {
284+
if ($entity->getEntityType()->isRevisionable()) {
285+
// Forces a New Revision for Not-create Operations.
286+
$entity->setNewRevision(TRUE);
287+
$entity->setRevisionCreationTime(\Drupal::time()->getRequestTime());
288+
// Set data for the revision
289+
$entity->setRevisionLogMessage('ADO modified via JSON Patch Search And Replace with Patch:'. $this->configuration['jsonpatch']);
290+
$entity->setRevisionUserId($this->currentUser->id());
291+
}
284292
$entity->save();
285293
}
286294
}

0 commit comments

Comments
 (0)