[development] gotcha: menu wildcards,foreach() and MENU_SUGGESTED_ITEM

Larry Garfield larry at garfieldtech.com
Wed Jul 16 14:47:25 UTC 2008

On Wed, 16 Jul 2008 14:15:05 +0800, "augustin (beginner)" <drupal.beginner at wechange.org> wrote:
> Hi again,
> On the issue, crell write:
> " A foreach loop inside a D6 menu handler is 99% of the time the WRONG way
> to
> do it."
> http://drupal.org/node/283198
> Have I stumbled upon the 1% of cases where it's the right thing to do?
> If you agree with crell and if I am wrong, I certainly would like to know
> it,
> and I'll revert the documentation changes I made.
> What is the proper way to have MENU_SUGGESTED_ITEM with wildcards and
> without
> a loop?
> See the issue for code examples.
> Thanks,
> Augustin.

I will defer to chx and pwolanin on this front.  I am by and large quoting chx here, who said something very similar to me back in February.  I won't say you have definitely not found that 1%, but the whole point of all the fancy math in the menu system is to not have to loop but to simply declare matchable patterns.  Looping should be very strongly discouraged.

--Larry Garfield

More information about the development mailing list