In a custom module of my own, I modify the menu structure extensively. As a result, code which relies on the arg() function can sometimes break.
There is technically nothing wrong with using arg(), but I wonder if, in the interest of improving compatibility and consistency in the webform code, an instance of arg() in webform could be replaced?
In this case, it's in webform_client_form(), where this sequence:
// Set the form action to the node ID in case this is being displayed on the
// teaser, subsequent pages should be on the node page directly.
if (arg(2) != 'submission') {
$form['#action'] = url('node/'. $node->nid);
}
can easily be changed to:
if (!$submission) {
...
Not only will this work equally as well, it is also more consistent with the rest of the function, which relies on the presence/absence of $submission to make decisions about what to display.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | webform_remove_arg_check.patch | 631 bytes | quicksketch |
| webform_client_form_arg.patch | 441 bytes | gribnif |
Comments
Comment #1
quicksketchMakes sense to me. This might have some negative effects on the 3.x version when placing a Webform in a block, but we can work those out in the 3.x branch. Committed attached patch to 2.x and 3.x.