Cannot modify language field in node form using hook_form_alter in drupal 7 I tried adding a description for the language field in a node form using hook_form_alter:

$form['language']['#description'] = t('Description');


The changes are not accepted, the language field stays as it is the description is not added. As far as i can tell this is not a problem with the hook, because changes to other fields work fine, only the language field does not change.
Any ideas what i'm doing wrong.
Your code doesn't work because the node edit/create form sets $form['language'] using the following code. (See node_form().)

  // Basic node information.
  // These elements are just values so they are not even sent to the client.
  foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language') as $key) {
    $form[$key] = array(
      '#type' =&gt; 'value', 
      '#value' =&gt; isset($node-&gt;$key) ? $node-&gt;$key : NULL,
    );
  }


It's then the Locale module that changes the form field in locale_form_node_form_alter() using the following code.

  if (isset($form['#node']-&gt;type) &amp;&amp; locale_multilingual_node_type($form['#node']-&gt;type)) {
    $form['language'] = array(
      '#type' =&gt; 'select', 
      '#title' =&gt; t('Language'), 
      '#default_value' =&gt; (isset($form['#node']-&gt;language) ? $form['#node']-&gt;language : ''), 
      '#options' =&gt; array(LANGUAGE_NONE =&gt; t('Language neutral')) + locale_language_list('name'),
    );
  }
  // Node type without language selector: assign the default for new nodes
  elseif (!isset($form['#node']-&gt;nid)) {
    $default = language_default();
    $form['language'] = array(
      '#type' =&gt; 'value', 
      '#value' =&gt; $default-&gt;language,
    );
  }


If your module is executed before the Locale module, its changes to the language form field are not retained, as the Locale module set $form['language'] to a different array.

In order for your code to work, you need to change the weight of your module, or implement hook_module_implements_alter() to alter the order hooks are executed.

function mymodule_module_implements_alter(&amp;$implementations, $hook) {
  if ($hook == 'form_alter') {
    // Move mymodule_form_alter() to the end of the list. module_implements()
    // iterates through $implementations with a foreach loop which PHP iterates
    // in the order that the items were added, so to move an item to the end of
    // the array, we remove it and then add it.
    $group = $implementations['mymodule'];
    unset($implementations['mymodule']);
    $implementations['mymodule'] = $group;
  }
}


This code changes also the order in which hook_form_FORM_ID_alter(), and hook_form_BASE_FORM_ID_alter() are executed.