You are here

function pathauto_i18n_node_form_alter in Pathauto i18n 8

Same name and namespace in other branches
  1. 7 modules/pathauto_i18n_node/pathauto_i18n_node.module \pathauto_i18n_node_form_alter()

Implements hook_form_alter().

File

modules/pathauto_i18n_node/pathauto_i18n_node.module, line 88
Provides tools for creating multilanguage aliases for nodes.

Code

function pathauto_i18n_node_form_alter(&$form, &$form_state, $form_id) {
  if (!empty($form['#node_edit_form']) && $form['#node_edit_form']) {

    // Add pathauto value if pathauto_i18n_status TRUE.
    // Remove alias value to prevent overwriting.
    if (isset($form['#node']->path['pathauto_i18n_status']) && $form['#node']->path['pathauto_i18n_status']) {
      $form['path']['pathauto']['#default_value'] = TRUE;
      $form['path']['alias']['#default_value'] = '';
    }
  }
}