public ModerationHandler::onPresave(ContentEntityInterface $entity, $default_revision, $published_state)
Operates on moderated content entities preSave().
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to modify.
bool $default_revision: Whether the new revision should be made the default revision.
bool $published_state: Whether the state being transitioned to is a published state or not.
Overrides ModerationHandlerInterface::onPresave
File
- core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php, line 32
Class
- ModerationHandler
- Common customizations for most/all entities.
Namespace
Drupal\content_moderation\Entity\Handler
Code
public function onPresave(ContentEntityInterface $entity, $default_revision, $published_state) { // This is probably not necessary if configuration is setup correctly. $entity->setNewRevision(TRUE); $entity->isDefaultRevision($default_revision); }
Please login to continue.