문제

I am initializing a number of items 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;

First entry is a parent entry and works fine. The following two are child entries. These last two menu entries remain invalid and redirects to parent page view. I fixed it with a small modification by eliminating first wild card '%/' mark from the path definitions.

Means:

$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 out what I am doing wrong by adding a wild card? Is more than two wild card are invalid?

도움이 되었습니까?

해결책

It is not mentioned sufficiently in the documentation, but there is a limit on the number of path elements you can use for a Drupal menu callback - see the MENU_MAX_PARTS constant.

For Drupal 6, this limit is seven, which your second and third path exceeded. Both of your fixes bring the element count down to seven, which is why those work.

다른 팁

I have fixed the issue without excepting first wild card as I mentioned it. But I could not found any logical reason.

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

to

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

and

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

to

$items['webtv/block/%/playlist/edit/%/new']
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top