function webform_menu in Webform 5.2
Same name and namespace in other branches
- 5 webform.module \webform_menu()
- 6.3 webform.module \webform_menu()
- 6.2 webform.module \webform_menu()
- 7.4 webform.module \webform_menu()
- 7.3 webform.module \webform_menu()
Implementation of hook_menu().
File
- ./
webform.module, line 67
Code
function webform_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
// Submissions listing.
$items[] = array(
'path' => 'admin/content/webform',
'title' => t('Webforms'),
'callback' => 'webform_admin_content',
'access' => user_access('access webform results'),
'description' => t('View and edit all the available webforms on your site.'),
'type' => MENU_NORMAL_ITEM,
);
// Admin Settings.
$items[] = array(
'path' => 'admin/settings/webform',
'title' => t('Webform'),
'callback' => 'drupal_get_form',
'callback arguments' => 'webform_admin_settings',
'access' => user_access('administer site configuration'),
'description' => t('Global configuration of webform functionality.'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
elseif (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load($nid);
$sid = arg(2) == 'submission' && is_numeric(arg(3)) ? arg(3) : NULL;
if ($node->nid && $node->type == 'webform') {
$items[] = array(
'path' => 'node/' . $nid,
'title' => $node->title,
// Set the title for the node menu item.
'callback' => 'node_page_view',
'callback arguments' => array(
$node,
),
'access' => node_access('view', $node),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'node/' . $nid . '/done',
'title' => t('Webform confirmation'),
'callback' => '_webform_confirmation',
'callback arguments' => array(
$node,
),
'access' => node_access('view', $node),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'node/' . $nid . '/edit/configuration',
'title' => t('Configuration'),
'callback' => 'node_page_edit',
'callback arguments' => array(
$node,
),
'access' => node_access('update', $node),
'weight' => 1,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/edit/components',
'title' => t('Form components'),
'callback' => 'webform_components',
'callback arguments' => array(
$node,
),
'access' => node_access('update', $node),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results',
'title' => t('Results'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
),
'access' => webform_results_access($node, 'access webform results'),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results/submissions',
'title' => t('Submissions'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
),
'access' => webform_results_access($node, 'access webform results'),
'weight' => 4,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results/analysis',
'title' => t('Analysis'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
'analysis',
),
'access' => webform_results_access($node, 'access webform results'),
'weight' => 5,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results/table',
'title' => t('Table'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
'table',
),
'access' => webform_results_access($node, 'access webform results'),
'weight' => 6,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results/download',
'title' => t('Download'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
'download',
),
'access' => webform_results_access($node, 'access webform results'),
'weight' => 7,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/results/clear',
'title' => t('Clear'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
'clear',
),
'access' => webform_results_access($node, 'clear webform results'),
'weight' => 8,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/submissions',
'title' => t('Submissions'),
'callback' => 'webform_results',
'callback arguments' => array(
$node,
'user_submissions',
),
'access' => user_access('access webform results') || user_access('access webform submissions') || user_access('access own webform submissions') && $user->uid,
'weight' => 2,
'type' => MENU_CALLBACK,
);
if (isset($sid)) {
include_once drupal_get_path('module', 'webform') . "/webform_submissions.inc";
$submission = webform_get_submission($node->nid, $sid);
$items[] = array(
'path' => 'node/' . $nid . '/submission/' . $sid,
'title' => t('Webform submission'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'webform_client_form_' . $node->nid,
$node,
$submission,
FALSE,
FALSE,
),
'access' => webform_submission_access($node, $submission, 'view'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'node/' . $nid . '/submission/' . $sid . '/view',
'title' => t('View'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'webform_client_form_' . $node->nid,
$node,
$submission,
FALSE,
FALSE,
),
'access' => webform_submission_access($node, $submission, 'view'),
'weight' => 0,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/submission/' . $sid . '/edit',
'title' => t('Edit'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'webform_client_form_' . $node->nid,
$node,
$submission,
TRUE,
FALSE,
),
'access' => webform_submission_access($node, $submission, 'edit'),
'weight' => 1,
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'node/' . $nid . '/submission/' . $sid . '/delete',
'title' => t('Delete'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'webform_submission_delete_form',
$node,
$submission,
),
'access' => webform_submission_access($node, $submission, 'delete'),
'weight' => 2,
'type' => MENU_LOCAL_TASK,
);
}
}
}
return $items;
}