Skip to content
Snippets Groups Projects
Commit 43f56129 authored by Justin Toupin's avatar Justin Toupin
Browse files

Issue #3419324: Revision notes field not cleared after save

parent 7819630f
No related branches found
No related tags found
1 merge request!38Clear the revision log field when an entity is saved.
......@@ -9,6 +9,7 @@ use Drupal\Core\Ajax\ReplaceCommand;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
......@@ -249,6 +250,16 @@ trait MercuryEditorEntityFormTrait {
$this->layoutParagraphsTempstore->set($layout);
}
}
// Clear the revision log message input to prevent it from being reused.
$entity_type = $this->entity->getEntityType();
if ($entity_type instanceof ContentEntityTypeInterface) {
$revision_field = $entity_type->getRevisionMetadataKey('revision_log_message');
if ($revision_field) {
$input = $form_state->getUserInput();
$input[$revision_field] = [];
$form_state->setUserInput($input);
}
}
// Re-initialize the form to correctly prepare the saved entity.
$this->init($form_state);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment