You are here

function webform_ajax_confirm_return_ajax_callback in Webform Ajax 7

Same name and namespace in other branches
  1. 7.2 webform_ajax.module \webform_ajax_confirm_return_ajax_callback()

"Return to form" link AJAX callback.

1 string reference to 'webform_ajax_confirm_return_ajax_callback'
webform_ajax_menu in ./webform_ajax.module
Implements hook_menu().

File

./webform_ajax.module, line 250
Webform AJAX module file.

Code

function webform_ajax_confirm_return_ajax_callback($node, $wrapper_id) {

  // Fake full page mode to force webform messages output.
  drupal_static_reset('arg');
  $real_get_q = $_GET['q'];
  $_GET['q'] = 'node/' . $node->nid;
  $node->webform['webform_ajax_wrapper_id'] = $wrapper_id;
  webform_node_view($node, 'full');

  // Restore real $_GET['q'].
  $_GET['q'] = $real_get_q;
  drupal_static_reset('arg');

  // Display the webform only if it is enabled. Otherwise, show messages.
  if ($node->content['webform']['#enabled']) {
    $output = $node->content['webform'];
  }
  else {
    $output = array(
      '#type' => 'markup',
      '#markup' => t('The webform cannot be displayed.'),
    );
  }
  return $output;
}