From 4acc455ca64a487716bb73345820e22d9ecd7743 Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Fri, 6 Sep 2024 12:54:06 -0400 Subject: [PATCH] Set log message during entity:save (#6103) --- src/Commands/core/EntityCommands.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Commands/core/EntityCommands.php b/src/Commands/core/EntityCommands.php index 6c414f2c81..6846b8d01b 100644 --- a/src/Commands/core/EntityCommands.php +++ b/src/Commands/core/EntityCommands.php @@ -12,6 +12,7 @@ use Drupal\Core\Entity\EntityStorageException; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Entity\Query\QueryInterface; +use Drupal\Core\Entity\RevisionLogInterface; use Drush\Attributes as CLI; use Drush\Commands\AutowireTrait; use Drush\Commands\DrushCommands; @@ -164,6 +165,9 @@ public function doSave(string $entity_type, array $ids, ?string $action): void $entity->setUnpublished(); } } + if (is_a($entity, RevisionLogInterface::class)) { + $entity->setRevisionLogMessage(dt('Re-saved by Drush entity:save. Action is !action.', ['!action' => $action ?? 'none'])); + } $entity->save(); } }