In hook_menu() array keys, you can specificy wildcard tokens to autoload certain objects, such as %node to get the node object.

Is there a wildcard autoloader token for webform submissions? Some googling I've done has returned no results.

I've also grepped the codebase of the webform module for autoload, also to no results.

1 Answer 1


It is looking for a _load() function. In the case of node, user, or taxonomy term arguments (eg %node), it is looking at node_load, user_load, etc.

If you passed %mymodule_foo as the wildcard, then it would look for mymodule_foo_load().

Therefore, if there is a webform submission _load function that loads a submission, thats what you want to use as the wildcard.

The wildcard you want to use is %webform_menu_submission. Webform has a corresponding _load function for it:

 * Menu loader callback. Load a webform submission if the given sid is a valid.
function webform_menu_submission_load($sid, $nid) {
  module_load_include('inc', 'webform', 'includes/webform.submissions');
  $submission = webform_get_submission($nid, $sid);
  return empty($submission) ? FALSE : $submission;

Note that this function also needs a $nid argument to work.

Registered paths may also contain special "auto-loader" wildcard components in the form of '%mymodule_abc', where the '%' part means that this path component is a wildcard, and the 'mymodule_abc' part defines the prefix for a load function, which here would be named mymodule_abc_load(). When a matching path is requested, your load function will receive as its first argument the path component in the position of the wildcard; load functions may also be passed additional arguments


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.