get the content moderation value on node update The module content moderation has been activated and a custom workflow added to a content type.
On editing content, when selecting a content moderation state then clicking on save, I would like to programmatically save that value in a variable.

$mod in that code doesn't display the latest values for moderation state chosen on update.

I wonder if what I get is the default revision value (as configured for a state, Révision par défaut Quand le contenu atteint cet état il devrait devenir la révision par défaut; ceci est implicite pour les états publiés.)  but it is definitely not the latest revision value.

function my_hook_entity_update(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity-&gt;getEntityTypeId() !== 'node') {
    return;
  }

  $content_id = $entity-&gt;id();
  $content = \Drupal\node\Entity\Node::load($content_id);       

  $mod=$content-&gt;get('moderation_state')-&gt;getValue();        
  var_dump($mod);
  die();
}


How do I get the latest value of content moderation on node update?
Getting the version of the entity meant getting the last revision and allow to get the correct value

function my_hook_entity_update(Drupal\Core\Entity\EntityInterface $entity) {    
  if ($entity-&gt;getEntityTypeId() !== 'node') {
    return;
  }

 $current_entity_lang = $entity-&gt;get('langcode')-&gt;value;
 $translated_entity = $entity-&gt;getTranslation($current_entity_lang);
 $mod = $translated_entity-&gt;get('moderation_state')-&gt;getValue());
}