You are here

function lingotek_setup_node_translation_settings_form in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()
  2. 7.2 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()
  3. 7.3 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()
  4. 7.5 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()
  5. 7.6 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()

Entity Translation Settings - Form Layout Select the Content Types and Fields to be Translated.

1 string reference to 'lingotek_setup_node_translation_settings_form'
lingotek_menu in ./lingotek.module
Implements hook_menu().

File

./lingotek.setup.inc, line 792

Code

function lingotek_setup_node_translation_settings_form($form, $form_state) {
  drupal_add_js(drupal_get_path('module', 'lingotek') . '/js/lingotek.admin.js');
  $fs['values'] = lingotek_get_global_profile();
  $fs['values']['profile_id'] = LingotekSync::PROFILE_CUSTOM;
  $form = lingotek_admin_node_translation_settings_form($form, $form_state, 'node');
  $content_defaults = lingotek_admin_profile_form($form, $fs);
  $form['lingotek_nodes_translation_method'] = $content_defaults['defaults']['lingotek_nodes_translation_method'];
  $form['lingotek_nodes_translation_method']['#weight'] = -3;
  $c = db_select('node', 'n')
    ->fields('n', array(
    'tnid',
  ))
    ->condition('n.tnid', 0, '<>')
    ->distinct()
    ->countQuery()
    ->execute()
    ->fetchField();
  $form['lingotek_overwrite_note'] = array(
    '#type' => 'item',
    '#title' => t('You have @count nodes with existing translations', array(
      '@count' => $c,
    )),
    '#states' => array(
      'visible' => array(
        ':input[name="lingotek_nodes_translation_method"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#weight' => -2,
  );
  $form['lingotek_overwrite'] = array(
    '#type' => 'checkbox',
    '#title' => t('Do not allow Lingotek to translate these nodes. <b>NOTE: Unchecking this option will cause Lingotek to overwrite your current translated content.</b>'),
    '#default_value' => TRUE,
    '#states' => array(
      'visible' => array(
        ':input[name="lingotek_nodes_translation_method"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
    '#weight' => -1,
  );
  if (is_array($_SESSION['lingotek_setup_path'])) {
    if (end($_SESSION['lingotek_setup_path']) == 'admin/config/lingotek/node-translation-settings') {
      $null = array_pop($_SESSION['lingotek_setup_path']);
    }

    // if the user went back, remove the last element, which is this page.
    $form['node_translation']['actions']['lingotek_back_button'] = lingotek_setup_link(end($_SESSION['lingotek_setup_path']), t('Previous Step'));
  }
  unset($form['node_translation']['actions']['submit']);
  $form['node_translation']['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Next'),
  );
  $form['lingotek_support_footer'] = lingotek_support_footer();
  return $form;
}