You are here

function lingotek_admin_additional_translation_settings_form_submit in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.3 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 984

Code

function lingotek_admin_additional_translation_settings_form_submit($form, &$form_state, $additional_operations = array()) {
  $form_state['values'] = array_merge($form_state['values'], $form_state['values']['config']);
  unset($form_state['values']['config']);
  system_settings_form_submit($form, $form_state);

  //if any configuration options are set then config translation is enabled
  if (variable_get('lingotek_translate_config_taxonomies', 0) || variable_get('lingotek_translate_config_blocks', 0) || variable_get('lingotek_translate_config_menus', 0) || variable_get('lingotek_translate_config_views', 0) || variable_get('lingotek_translate_config_builtins', 0) || variable_get('lingotek_translate_config_fields', 0) || variable_get('lingotek_translate_config_misc', 0)) {
    variable_set('lingotek_translate_config', TRUE);
  }
  else {

    // mark lingotek_translate_config to false if no config is to be translated
    variable_set('lingotek_translate_config', FALSE);
  }

  // prepare for any configuration translation, if applicable
  $config_groups = array();
  if (variable_get('lingotek_translate_config_blocks', 0) && isset($form_state['input']['lingotek_prepare_config_blocks'])) {
    lingotek_admin_prepare_blocks();
    $config_groups['blocks'] = 'blocks';
  }
  if (variable_get('lingotek_translate_config_taxonomies', 0) && isset($form_state['input']['lingotek_prepare_config_taxonomies'])) {
    lingotek_admin_prepare_taxonomies();
    $config_groups['taxonomy'] = 'taxonomy';
  }
  if (variable_get('lingotek_translate_config_menus', 0) && isset($form_state['input']['lingotek_prepare_config_menus'])) {
    lingotek_admin_prepare_menus();
    $config_groups['menu'] = 'menu';
  }

  // refresh all strings for each config type
  if (count($config_groups)) {

    // combine string refresh operations with other additional operations
    $config_refresh_batch = i18n_string_refresh_batch($config_groups, $delete = FALSE);
    if (isset($config_refresh_batch['operations'])) {
      $additional_operations = array_merge($additional_operations, $config_refresh_batch['operations']);
    }
  }
  if (variable_get('lingotek_translate_config_builtins')) {
    lingotek_admin_prepare_builtins($additional_operations);
  }
  else {
    lingotek_admin_setup_nonbuiltins_batch($additional_operations);
  }
  lingotek_save_config_profile($form_state);

  // if this function is being called as part of the setup process, continue to
  // the dashboard to make sure they get a language configured.  Otherwise,
  // put them back to the settings page when finished.
  $final_destination = 'admin/settings/lingotek/settings';
  if (isset($_SESSION['lingotek_setup_path']) && is_array($_SESSION['lingotek_setup_path']) && end($_SESSION['lingotek_setup_path']) == LINGOTEK_MENU_LANG_BASE_URL . '/additional-translation-settings') {

    // Remove the setup path so future checks will not think setup just completed.
    unset($_SESSION['lingotek_setup_path']);
    $final_destination = 'admin/settings/lingotek';
  }
  if (count(batch_get())) {
    batch_process($final_destination);
  }
  else {
    drupal_goto($final_destination, array(
      'fragment' => 'ltk-config',
    ));
  }
}