function webform_submission_page in Webform 7.3
Same name and namespace in other branches
- 6.3 includes/webform.submissions.inc \webform_submission_page()
- 7.4 includes/webform.submissions.inc \webform_submission_page()
Menu callback; Present a Webform submission page for display or editing.
1 string reference to 'webform_submission_page'
- webform_menu in ./
webform.module - Implements hook_menu().
File
- includes/
webform.submissions.inc, line 382 - This file is loaded when handling submissions, either submitting new, editing, or viewing. It also contains all CRUD functions for submissions.
Code
function webform_submission_page($node, $submission, $format) {
global $user;
// Render the admin UI breadcrumb.
webform_set_breadcrumb($node, $submission);
// Set the correct page title.
drupal_set_title(webform_submission_title($node, $submission));
if ($format == 'form') {
$output = drupal_get_form('webform_client_form_' . $node->nid, $node, $submission);
}
else {
$output = webform_submission_render($node, $submission, NULL, $format);
}
// Determine the mode in which we're displaying this submission.
$mode = $format != 'form' ? 'display' : 'form';
if (strpos(request_uri(), 'print/') !== FALSE) {
$mode = 'print';
}
if (strpos(request_uri(), 'printpdf/') !== FALSE) {
$mode = 'pdf';
}
// Add navigation for administrators.
if (webform_results_access($node)) {
$navigation = theme('webform_submission_navigation', array(
'node' => $node,
'submission' => $submission,
'mode' => $mode,
));
$information = theme('webform_submission_information', array(
'node' => $node,
'submission' => $submission,
'mode' => $mode,
));
}
else {
$navigation = NULL;
$information = NULL;
}
// Actions may be shown to all users.
$actions = theme('links', array(
'links' => module_invoke_all('webform_submission_actions', $node, $submission),
'attributes' => array(
'class' => array(
'links',
'inline',
'webform-submission-actions',
),
),
));
// Disable the page cache for anonymous users viewing or editing submissions.
if (!$user->uid) {
webform_disable_page_cache();
}
$page = array(
'#theme' => 'webform_submission_page',
'#node' => $node,
'#mode' => $mode,
'#submission' => $submission,
'#submission_content' => $output,
'#submission_navigation' => $navigation,
'#submission_information' => $information,
'#submission_actions' => $actions,
);
$page['#attached']['library'][] = array(
'webform',
'admin',
);
return $page;
}