Hi all,

According to the hook_menu() documentation:

If there is no other registered path that fits the requested path better, any further path components are passed to the callback function.

But when I tried implementing a menu item with 'modal' => TRUE and setting a link that included an extra path argument, the extra argument is coming through as 0 in my callback function. (With a non-modal menu item, the value comes through as expected.) I figure something is going on with the arguments manipulation in ctools_automodal_menu_alter()...

Here's a simplified code example:

// In the module...
function mymodule_menu() {
  $items['modal-args/%'] = array(
    'type' => MENU_CALLBACK,
    'page callback' => 'mymodule_args_test',
    'page arguments' => array(1),
    'modal' => TRUE,
    ...
  );

  return $items;
}


function mymodule_args_test($required, $optional) {
  // $optional is always 0 here. In example link below,
  // it should be "extra".
}

// In a template file, add a link with an extra arg.
print l("Test modal args", "modal-args/required/extra");

Comments

moshansky’s picture

I've also encountered this issue in (7.x-1.1+1-dev). In particular, the "nojs" parameter seems to be part of the issue, as debugging will show that the parameter in that position will not be set while further arguments are. Additionally, a trailing argument beyond those defined seems to cause the last missing optional argument to work, The first optional argument is still invalid however.

adamtyoung’s picture

Issue summary: View changes

Does the above _menu hook still open the window in a modal frame? When I add an argument it seems to break the modal functionality and just opens the form in the parent window.