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.

Comments

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new631 bytes

Makes 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.