I had been working on module and well aware of hook_menu for passing url arguments to call back. For instance:
$items['webtv/block/%/playlist/edit/%'] = array(
...
'page callback' => 'drupal_get_form',
'page arguments' => array('webtv_playlist_form', 5, 2),
...
);
and callback as
function webtv_playlist_form($form_state, $fifth_arg, $second_arg){
...
}
Beside that arg() function is another utility to get url arguments by their positions.
$second_arg = arg(2);
$fifth_arg = arg(5);
When I enable locale module to make web as multilingual, URLs are classified with prefix as language symbol. Example:
en/webtv/block/%/playlist/edit/%
OR
nl/webtv/block/%/playlist/edit/%
This thing displaces the logical placement of arguments to right, now the correct placement of arguments (according to example) is:
$second_arg = arg(3);
$fifth_arg = arg(6);
How to set-up module independent of such argument placement issues?
Looking at Drupal core code (in example,
node_menu()
), menu callback using menu placeholders are not adjusted to work when locale.module is enabled, nor local.module alters the menus defined from other modules. In fact,language_initialize()
, called on Drupal bootstrap contains the following code:The code is removing the language ID passed in the URL. If locale.module is correctly set, the menu callback definitions should not be changed when the module is enabled.