function lingotek_advanced_parsing_upgrade_form_submit in Lingotek Translation 7.7
Same name and namespace in other branches
- 7.2 lingotek.page.inc \lingotek_advanced_parsing_upgrade_form_submit()
- 7.3 lingotek.page.inc \lingotek_advanced_parsing_upgrade_form_submit()
- 7.4 lingotek.page.inc \lingotek_advanced_parsing_upgrade_form_submit()
- 7.5 lingotek.page.inc \lingotek_advanced_parsing_upgrade_form_submit()
- 7.6 lingotek.page.inc \lingotek_advanced_parsing_upgrade_form_submit()
Submit handler for the lingotek_advanced_parsing_upgrade_form form.
Parameters
array $form: A FAPI form array.
array $form_state: A FAPI form state array.
File
- ./
lingotek.page.inc, line 503 - Lingotek Tab for Nodes
Code
function lingotek_advanced_parsing_upgrade_form_submit($form, $form_state) {
$error = FALSE;
if (!empty($form_state['values']['node_id'])) {
lingotek_keystore('node', $form_state['values']['node_id'], 'use_advanced_parsing', 1);
$target_node = lingotek_node_load_default($form_state['values']['node_id']);
$entity_type = isset($target_node) && isset($target_node->type) ? $target_node->type : NULL;
if ($target_node->nid) {
if (LingotekApi::instance()
->updateContentDocument(LingotekEntity::load($target_node, $entity_type))) {
drupal_set_message(t('This node has been upgraded to use advanced content parsing.'));
}
else {
$error = TRUE;
LingotekLog::error('Error updating node for advanced content parsing. Lingotek updateContentDocument call failed.', array());
}
}
else {
$error = TRUE;
LingotekLog::error('Unable to load target node for content parsing upgrade: @node_id', array(
'@node_id' => $form_state['values']['node_id'],
));
}
}
else {
$error = TRUE;
LingotekLog::error('No target node ID in parsing upgrade form data.', array());
}
if ($error) {
drupal_set_message(t('There was an error upgrading this node. It has <strong>not</strong> been updated to use advanced parsing.'), 'error');
}
}