You are here

function mb_comment_cancel_action in More Buttons 7

The "Cancel" action.

Handle different submit actions and make different redirects.

See also

mb_comment_cancel_validate()

1 call to mb_comment_cancel_action()
mb_comment_cancel_validate in mb_comment/mb_comment.module
Implements hook_validate().

File

mb_comment/mb_comment.module, line 177
Provides a Cancel button for comments.

Code

function mb_comment_cancel_action(&$form, &$form_state) {

  // Hide the error messages.
  drupal_get_messages('error');
  $redirect = 'node/' . $form['nid']['#value'];
  if (isset($form['comment_referer']['#value'])) {
    $redirect = $form['comment_referer']['#value'];
  }
  drupal_goto($redirect);
}