function workbench_moderation_moderate_form_submit in Workbench Moderation 7.3
Same name and namespace in other branches
- 7 workbench_moderation.module \workbench_moderation_moderate_form_submit()
File
- ./
workbench_moderation.module, line 1862 - Content moderation for Workbench.
Code
function workbench_moderation_moderate_form_submit($form, &$form_state) {
if (_workbench_moderation_moderate_access($form_state['values']['node'], $form_state['values']['state'])) {
workbench_moderation_moderate(node_load($form_state['values']['node']->nid, $form_state['values']['node']->vid), $form_state['values']['state']);
}
// This is not ideal, but if the form is invoked from a node's draft tab and
// used to publish the node, the draft tab will not be available after
// publishing, and Drupal's will throw an access denied error before it is
// able to redirect to the published revision.
if (!empty($form['#destination'])) {
if ($form_state['values']['state'] == workbench_moderation_state_published()) {
if ($uri = entity_uri('node', $form['node']['#value'])) {
// Disable lookup of the path alias, since the path alias might get
// changed by modules such as Pathauto.
$uri['options']['alias'] = TRUE;
$form_state['redirect'] = array(
$uri['path'],
$uri['options'],
);
}
}
else {
$form_state['redirect'] = $form['#destination'];
}
}
}