You are here

function lingotek_admin_additional_translation_settings_form_submit in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.7 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form_submit()
  2. 7.4 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form_submit()
  3. 7.5 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form_submit()
  4. 7.6 lingotek.admin.inc \lingotek_admin_additional_translation_settings_form_submit()
1 call to lingotek_admin_additional_translation_settings_form_submit()
lingotek_setup_additional_translation_settings_form_submit in ./lingotek.setup.inc
1 string reference to 'lingotek_admin_additional_translation_settings_form_submit'
lingotek_admin_additional_translation_settings_form in ./lingotek.admin.inc
Additional translation form

File

./lingotek.admin.inc, line 443

Code

function lingotek_admin_additional_translation_settings_form_submit($form, &$form_state) {
  system_settings_form_submit($form, $form_state);

  //This code configures the content entity and it's fields so that they can be translated.
  if ($form_state['values']['lingotek_translate_comments']) {
    foreach ($form_state['values']['lingotek_translate_comments_node_types'] as $content_type => $value) {
      if (!title_field_replacement_enabled('comment', 'comment_node_' . $content_type, 'subject')) {
        title_field_replacement_toggle('comment', 'comment_node_' . $content_type, 'subject');
        title_field_replacement_batch_set('comment', 'comment_node_' . $content_type, 'subject');
      }
    }
    $field = field_info_field('subject_field');
    $field['lingotek_translatable'] = TRUE;
    $field['translatable'] = TRUE;
    field_update_field($field);
    $field = field_info_field('comment_body');
    $field['lingotek_translatable'] = TRUE;
    $field['translatable'] = TRUE;
    field_update_field($field);

    // This is needed for versions of Drupal core 7.10 and lower. See http://drupal.org/node/1380660 for details.
    drupal_static_reset('field_available_languages');
  }

  // Enabling/disabling Lingotek comment translation will have an effect on the comment entity.
  entity_info_cache_clear();
  entity_get_info('comment');

  // prepare for any configuration translation, if applicable
  if (variable_get('lingotek_translate_config', 0)) {
    if (variable_get('lingotek_translate_config_blocks', 0)) {
      lingotek_admin_prepare_blocks();
    }
    if (variable_get('lingotek_translate_config_taxonomies', 0)) {
      lingotek_admin_prepare_taxonomies();
    }
    if (variable_get('lingotek_translate_config_menus', 0)) {
      lingotek_admin_prepare_menus();
    }
    if (variable_get('lingotek_translate_config_views', 0)) {
      lingotek_admin_prepare_views();
    }

    // WTD: run the translation strings refresh
  }
  else {

    // unset all sub-translation options
    variable_set('lingotek_translate_config_builtins', 0);
    variable_set('lingotek_translate_config_blocks', 0);
    variable_set('lingotek_translate_config_taxonomies', 0);
    variable_set('lingotek_translate_config_menus', 0);
    variable_set('lingotek_translate_config_views', 0);
  }
}