You are here

function lingotek_admin_additional_translation_settings_form in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  2. 7.4 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  3. 7.5 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()
  4. 7.6 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form()

Additional translation form

1 call to lingotek_admin_additional_translation_settings_form()
lingotek_setup_additional_translation_settings_form in ./lingotek.setup.inc
1 string reference to 'lingotek_admin_additional_translation_settings_form'
lingotek_admin_configuration_view in ./lingotek.admin.inc

File

./lingotek.admin.inc, line 284

Code

function lingotek_admin_additional_translation_settings_form($form, &$form_state, $show_fieldset = FALSE) {
  global $base_url;
  $api = LingotekApi::instance();

  //$setup_complete = variable_get('lingotek_setup_complete', 0);
  $setup_complete = lingotek_setup_check_credentials();
  $account = LingotekAccount::instance();
  $is_enterprise = $account
    ->isEnterprise();

  /*
   * Comment translation
   */
  $form['additional_translation'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => $setup_complete ? t('Additional Translation') : t('Which additional items do you want translated?'),
    //'#description' => t('Enable/disable and set defaults for comment translation.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#group' => 'administrative_settings',
    'actions' => array(
      '#type' => 'actions',
      'submit' => array(
        '#type' => 'submit',
        '#value' => t('Save'),
      ),
    ),
    '#validate' => array(
      'lingotek_admin_additional_translation_settings_form_validate',
    ),
    '#submit' => array(
      'lingotek_admin_additional_translation_settings_form_submit',
    ),
  );
  $form['additional_translation']['lingotek_translate_comments'] = array(
    '#type' => 'checkbox',
    '#title' => t('Translate comments'),
    '#description' => t('When enabled, comments on nodes of the specified types will be automatically translated.'),
    '#default_value' => variable_get('lingotek_translate_comments', 0),
  );
  $form['additional_translation']['lingotek_translate_comments_options'] = array(
    '#title' => 'Comment settings',
    '#type' => 'fieldset',
    '#states' => array(
      'visible' => array(
        ':input[name="lingotek_translate_comments"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $type_options = array();
  foreach (node_type_get_types() as $type => $type_data) {
    $type_options[$type] = $type_data->name;
  }
  $form['additional_translation']['lingotek_translate_comments_options']['lingotek_translate_comments_node_types'] = array(
    '#type' => 'select',
    '#title' => t('Comment translation node types'),
    '#description' => t('When comment translation is enabled, only automatically translate comments on the selected node types.'),
    '#options' => $type_options,
    '#multiple' => TRUE,
    '#default_value' => variable_get('lingotek_translate_comments_node_types', ''),
  );
  if ($is_enterprise) {
    $form['additional_translation']['lingotek_translate_comments_options']['lingotek_translate_comments_workflow_id'] = array(
      '#type' => 'select',
      '#title' => t('Comment translation Workflow'),
      '#description' => t('When comment translation is enabled, use this workflow for translating
        comments. Since there is no Drupal UI for managing workflow phases for comments, it is
        recommended that you choose a Workflow that only consists of a single machine translation Phase.'),
      '#options' => $api
        ->listWorkflows(),
      '#default_value' => variable_get('lingotek_translate_comments_workflow_id', ''),
    );
  }

  // Configuration translation (ie. taxonomies, menus, etc.)
  $form['additional_translation']['lingotek_translate_config'] = array(
    '#type' => 'checkbox',
    '#title' => t('Translate configurations (requires modules <a href="https://drupal.org/project/variable">Variable</a> and <a href="https://drupal.org/project/i18n">i18n</a> with Translation Sets enabled)'),
    '#description' => t('When enabled, the specified configuration types will be included in bulk management processes for translation.'),
    '#default_value' => variable_get('lingotek_translate_config', 1),
  );
  $form['additional_translation']['lingotek_translate_config_options'] = array(
    '#type' => 'fieldset',
    '#title' => t('Configurations settings'),
    '#description' => t('Choose the configuration types you want to have translated:'),
    '#states' => array(
      'visible' => array(
        ':input[name="lingotek_translate_config"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_builtins'] = array(
    '#type' => 'checkbox',
    '#title' => t('Built-in Interface'),
    '#description' => t('If configuration translation is enabled, all built-in strings will be automatically translated.'),
    '#default_value' => 1,
    '#disabled' => TRUE,
  );
  $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_blocks'] = array(
    '#type' => 'checkbox',
    '#title' => t('Blocks (requires <a href="https://drupal.org/project/i18n">i18n</a> Block Languages enabled)'),
    '#description' => t('When enabled, all blocks will be updated automatically to be translatable in the Languages settings.'),
    '#default_value' => variable_get('lingotek_translate_config_blocks', 1),
  );
  $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_taxonomies'] = array(
    '#type' => 'checkbox',
    '#title' => t('Taxonomies (requires <a href="https://drupal.org/project/i18n">i18n</a> Taxonomy Translation enabled)'),
    '#description' => t('When enabled, all taxonomies will be updated automatically to use translation mode \'Localize\' in the Multilingual Options.'),
    '#default_value' => variable_get('lingotek_translate_config_taxonomies', 1),
  );
  $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_menus'] = array(
    '#type' => 'checkbox',
    '#title' => t('Menus (requires <a href="https://drupal.org/project/i18n">i18n</a> Menu Translation enabled)'),
    '#description' => t('When enabled, all menus will be updated to use \'Translate and Localize\' in the Multilingual Options.'),
    '#default_value' => variable_get('lingotek_translate_config_menus', 1),
  );
  $form['additional_translation']['lingotek_translate_config_options']['lingotek_translate_config_views'] = array(
    '#type' => 'checkbox',
    '#title' => t('Views (requires modules <a href="https://drupal.org/project/views">Views</a>, <a href="https://drupal.org/project/ctools">Chaos Tools</a>, and <a href="https://drupal.org/project/i18nviews">i18n Views</a>)'),
    '#description' => t('When enabled, all configured views will be searched for translatable strings.  Note this will not generally include translation of all results generated by each view.'),
    '#default_value' => variable_get('lingotek_translate_config_views', 1),
  );
  return $form;
}