You are here

function i18n_node_form_node_form_alter in Internationalization 7

Implements hook_form_BASE_FORM_ID_alter().

File

i18n_node/i18n_node.module, line 457
Internationalization (i18n) module - Node type handling

Code

function i18n_node_form_node_form_alter(&$form, $form_state) {
  $node = $form['#node'];

  /**
   * i18n has to override locale.module
   * drupal_alter() fails to order modules correctly in some cases
   * for example specific hooks like hook_form_BASE_FORM_ID_alter
   *
   * its not possbile to reorder hook_form_BASE_FORM_ID_alter with
   * hook_module_implements_alter
   *
   * @see http://drupal.org/node/765860
   */

  // Replace core's node submit callback with our own,
  // in order to translate the node type name.
  $key = array_search('node_form_submit', $form['actions']['submit']['#submit']);
  if ($key !== FALSE) {
    $form['actions']['submit']['#submit'][$key] = 'i18n_node_form_submit';
  }

  // call a 'private' implemenation of i18n_node_form_node_form_alter()
  $form['#after_build'][] = '_i18n_node_form_node_form_alter';
}