get language on form alter I try to get selected language for specified node (I mean in edit form) on form alter with following snippet in MODULENAME.module

use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\HttpFoundation\Request;

function MODULENAME_form_alter(array &amp;$form, FormStateInterface $form_state, $form_id) {
    if ($form_id == 'node_trends_edit_form') {
        kint($form);
        kint($form_state-&gt;getValue('langcode'));
        kint($form_state-&gt;getValues());
    }
}


BUT    results for   kint($form_state-&gt;getValue('langcode'));           kint($form_state-&gt;getValues()); are NULL.

how can I get language selected for node on form_alter
The code to get the entity language is present in language_form_alter(), which you can take as an example to write your code.

  $form_object = $form_state-&gt;getFormObject();
  if ($form_object instanceof ContentEntityFormInterface &amp;&amp; $form_object-&gt;getEntity()-&gt;getEntityType()-&gt;hasKey('langcode')) {
    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $form_object-&gt;getEntity();
    $entity_type = $entity-&gt;getEntityType();
    $langcode_key = $entity_type-&gt;getKey('langcode');

    // Your code goes here.

  }


If you are sure the edit form is for a content entity (such as a node), you could remove the part verifying that $form_object is a content entity object. I would leave it, but that is my personal preference.