How do I get the submitted moderation state of a custom block? I am a bit new for Drupal and currently working on Drupal8. I need to implement custom restrictions for workflow. Basically i want to get the submitted value of moderation_state filed in mymodule_form_alte   

Here are the things that i have tried but all returns Null. The strange thing is that the below method works for node but do not work for block_content

 function mymodule_form_alter($form, &amp;$form_state, $form_id) {
   $formSate = $form_state-&gt;getValue('moderation_state')[0]['valye'];
   var_dump($formState); // Output : Null

   $formSate = $form['moderation_state']['widget']['#default_value'];
   var_dump($formState); // Output : return the default value of dropdown not the one that i have selected
}


Here is the moderation_state field
all most there try the following 

// Get the current  entity.
$entity = $form_state-&gt;getFormObject()-&gt;getEntity();
$moderation_state = $entity-&gt;get('moderation_state')-&gt;getString();
// Do the things.


or 
   in a submit or validation thing 
   try to 

// use dump() as it is way better 
dump($form_state-&gt;getValues()) // &lt;-- and find in the array