i actually need it for the content_moderation_state entity
function hook_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
if ($entity->getEntityTypeId() !== 'content_moderation_state' ) {
return;
}
$moderation_state = $entity->get('moderation_state')->getString();
//code to get the original entity moderation state