function lingotek_admin_profile_manage in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lingotek.admin.inc \lingotek_admin_profile_manage()
- 7.4 lingotek.admin.inc \lingotek_admin_profile_manage()
- 7.5 lingotek.admin.inc \lingotek_admin_profile_manage()
1 string reference to 'lingotek_admin_profile_manage'
- lingotek_menu in ./
lingotek.module - Implements hook_menu().
File
- ./
lingotek.admin.inc, line 1629
Code
function lingotek_admin_profile_manage($profile_id) {
$profiles = lingotek_get_profiles();
if ($profile_id == 'add') {
$profile = (object) array(
'name' => '',
'lingotek_nodes_translation_method' => 'field',
'create_lingotek_document' => 1,
'sync_method' => 1,
'allow_target_localization' => 0,
'allow_source_overwriting' => 0,
'allow_community_translation' => 0,
'url_alias_translation' => 0,
);
end($profiles);
// Set ID to one more than the current count, and then increment as needed.
$profile_id = count($profiles) + 1;
while (isset($profiles[$profile_id])) {
$profile_id++;
}
}
else {
$profile = lingotek_get_global_profile();
$profile = array_merge($profile, $profiles[$profile_id]);
}
ctools_include('node.pages', 'node', '');
ctools_include('modal');
ctools_include('ajax');
$form_state = array(
'ajax' => TRUE,
);
$form_state['values']['profile_id'] = $profile_id;
foreach ($profile as $key => $value) {
$form_state['values'][$key] = $value;
}
$output = ctools_modal_form_wrapper('lingotek_admin_profile_form', $form_state);
if (!empty($form_state['executed'])) {
// Create ajax command array, dismiss the modal window.
$commands = array();
$commands[] = ctools_modal_command_dismiss();
$commands[] = ctools_ajax_command_redirect('admin/settings/lingotek/settings', 0, array(
'fragment' => 'ltk-profiles',
));
$commands[] = ctools_ajax_command_reload();
print ajax_render($commands);
drupal_exit();
}
print ajax_render($output);
}