[development] gotcha: menu wildcards, foreach() and MENU_SUGGESTED_ITEM
drupal.beginner at wechange.org
Wed Jul 16 03:46:20 UTC 2008
I just noticed a bug in directory.module, and I see the exact same bug in
This bug involves the new menu system.
In D5, we used to be able to dynamically create a series of menu items with a
foreach loop within hook_menu().
When upgrading to D6, the tendency has been to remove the foreach loop, and
replace the arg(n) with a wildcard loader, but it is the wrong solution.
In most cases, you don't want to remove the foreach() loop you had in D5.
Within D6, it is perfectly ok to have a loop, recursively declaring several
well defined menu items, e.g. one item for each vocabulary. When you have
such a loop, do not use the wildcard loader. For a detailed example see this
I have updated the documentation in the handbook.
More information about the development