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, &$form_state, $form_id) {
$formSate = $form_state->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
}