function lingotek_setup_node_translation_settings_form_submit in Lingotek Translation 7.2
Same name and namespace in other branches
- 7.7 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
- 7.3 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
- 7.4 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
- 7.5 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
- 7.6 lingotek.setup.inc \lingotek_setup_node_translation_settings_form_submit()
Node Translation Settings - Form Submit
File
- ./
lingotek.setup.inc, line 808 - Lingotek Easy Install Process.
Code
function lingotek_setup_node_translation_settings_form_submit($form, &$form_state) {
$translate = array();
foreach ($form_state['values'] as $key => $value) {
// Look for Selected Content Types and Fields.
if (FALSE !== strpos($key, '_SEPERATOR_')) {
// And only if set to translate
if ($value != 0) {
$parts = explode('_SEPERATOR_', $key);
$content_type = $parts[0];
$content_field = $parts[1];
$translate[$content_type][] = $content_field;
// Set this content type to be Lingotek translated.
variable_set('language_content_type_' . $content_type, LINGOTEK_ENABLED);
// Set this field to 'translatable'.
// Update the field via the Field API (Instead of the direct db_update)
$field = field_info_field($content_field);
$field['translatable'] = 1;
$field['lingotek_translatable'] = 1;
field_update_field($field);
}
}
// END: Selected Content Types and Fields
// Look for any nodes we need to do the Title swap for.
if (FALSE !== strpos($key, 'title_swap_')) {
// And only if set to swap
if ($value != 0) {
$content_type = substr($key, strlen('title_swap_'));
//dpm( 'Title Swap: ' . $content_type );
// Do the actual title replacement
$title_entity = 'node';
$title_bundle = $content_type;
$title_field = 'title';
// Use the Title module to migrate the content.
if (title_field_replacement_toggle($title_entity, $title_bundle, $title_field)) {
title_field_replacement_batch_set($title_entity, $title_bundle, $title_field);
}
// Make sure the title field gets flagged for Lingotek translation.
$translate[$content_type][] = 'title_field';
$field = field_info_field('title_field');
$field['translatable'] = 1;
$field['lingotek_translatable'] = 1;
field_update_field($field);
}
}
// END: Title Swap
}
// END: foreach form value
lingotek_cleanup_utility(FALSE);
$_SESSION['lingotek_setup_path'][] = 'admin/config/lingotek/node-translation-settings';
variable_set('lingotek_translate_fields', $translate);
variable_set('lingotek_setup_complete', 1);
// Mark Lingotek Configuration as Complete
drupal_set_message(t('You have completed setup successfully!'));
$form_state['redirect'] = LINGOTEK_BASE_URL;
// Redirect to start using Lingotek
//$form_state['redirect'] = 'admin/config/lingotek/setup-complete';
//drupal_goto( 'admin/config/lingotek/setup-complete' );
}