Hook_menu () - unexpected behavior (longer path)

I initialize several elements via hook_menu (Drupal 6)

...
$items['webtv/block/%/playlist/edit/%'] = array(
  ...
  'page arguments' => array('webtv_playlist_form', 2, 5),
  ...
); 

$items['webtv/block/%/playlist/edit/%/filter/new'] = array(
  ...
  'page arguments' => array('webtv_playlist_param_form', 2, 5),
  ...
);

$items['webtv/block/%/playlist/edit/%/filter/%'] = array(
  ...
  'page arguments' => array('webtv_playlist_param_form', 2, 5, 7),
  ...
);

return $items;

The first record is parent and works fine. The next two are children. These last two menu entries remain invalid and are redirected to the parent view. I fixed it with a slight modification, excluding the first sign of the "% /" wild card from the path definitions.

Facilities:

$items['webtv/block/%/playlist/edit/%/filter/%']

to

$items['webtv/block/playlist/edit/%/filter/%']

and

$items['webtv/block/%/playlist/edit/%/filter/new']

to

$items['webtv/block/playlist/edit/%/filter/new']

Please help me, what am I doing wrong by adding a wild card? Is more than two wild cards unacceptable?

+3
source share
2 answers

, , Drupal - . MENU_MAX_PARTS .

Drupal 6 , . , .

+5

wild-, . .

$items['webtv/block/%/playlist/edit/%/filter/%']

$items['webtv/block/%/playlist/edit/%/%']

$items['webtv/block/%/playlist/edit/%/filter/new']

$items['webtv/block/%/playlist/edit/%/new']
0

Source: https://habr.com/ru/post/1759282/


All Articles