You are here

function lingotek_admin_comment_translation_settings_form in Lingotek Translation 7.4

Additional translation form

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

File

./lingotek.admin.inc, line 403

Code

function lingotek_admin_comment_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_is_config_missing();
  $account = LingotekAccount::instance();
  $is_enterprise = $account
    ->isEnterprise();

  /*
   * Comment translation
   */
  $form['comment_translation'] = array(
    '#type' => $show_fieldset ? 'fieldset' : 'item',
    '#title' => $setup_complete ? t('Translate Comments') : t('Which comment 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'),
      ),
    ),
    '#submit' => array(
      'lingotek_admin_additional_translation_settings_form_submit',
    ),
  );
  $form['comment_translation'][] = array(
    '#type' => 'item',
    '#description' => t('Automatically translate comments on the selected content types.'),
  );
  $type_options = array();
  $type_defaults = array();
  foreach (node_type_get_types() as $type => $type_data) {
    $type_options[$type] = $type_data->name;
    $type_defaults[$type] = $type;
  }
  $form['comment_translation']['lingotek_translate_comments_options']['lingotek_translate_comments_node_types'] = array(
    '#type' => 'checkboxes',
    '#options' => $type_options,
    '#multiple' => TRUE,
    '#default_value' => variable_get('lingotek_translate_comments_node_types', $setup_complete ? array() : $type_defaults),
  );
  if ($is_enterprise) {
    $form['comment_translation']['lingotek_translate_comments_options']['lingotek_translate_comments_workflow_id'] = array(
      '#type' => 'select',
      '#title' => t('Workflow'),
      '#description' => t('This workflow will be used to translate 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', ''),
    );
  }
  return $form;
}