You are here

function lingotek_setup_node_translation_settings_form in Lingotek Translation 7.6

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.4 lingotek.setup.inc \lingotek_setup_node_translation_settings_form()
  5. 7.5 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 699

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_entity_bundle_profiles_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();
  if ($c > 0) {
    $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 (isset($_SESSION['lingotek_setup_path']) && is_array($_SESSION['lingotek_setup_path'])) {
    if (end($_SESSION['lingotek_setup_path']) == lingotek_get_entity_setup_path('node')) {
      $null = array_pop($_SESSION['lingotek_setup_path']);
    }

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