function tca_node_node_form_submit in Token Content Access 7
Custom submit function for the node form.
This will fire after the regular submit function, and it's purpose is to make sure that the user doesn't get redirected to node/123 after saving the node, if any Token Content Access action is enabled. This works by redirecting the user to node/123/edit, if a destination parameter hasn't been set.
See also
1 string reference to 'tca_node_node_form_submit'
- tca_node_form_node_form_alter in tca_node/
tca_node.module - Implements hook_form_FORM_ID_alter().
File
- tca_node/
tca_node.module, line 66 - Main module file for Token Content Access nodes module.
Code
function tca_node_node_form_submit($form, &$form_state) {
// If the action says anything else than to display the content, make sure
// that the user doesn't land on the node view page. We'll check if a custom
// redirect path has been set, otherwise, we'll redirect the user to the edit
// page again.
$active = isset($form_state['values']['tca_active']) && $form_state['values']['tca_active'] != 0 || !isset($form_state['values']['tca_active']) && tca_get_active_entity('node', $form['#node']) ? TRUE : FALSE;
if ($active && $form_state['redirect'] == 'node/' . $form_state['values']['nid']) {
$form_state['redirect'] = 'node/' . $form_state['values']['nid'] . '/edit';
}
}