[development] Question on Drupal 6 menus
Khalid Baheyeldin
kb at 2bits.com
Fri Jan 4 02:28:23 UTC 2008
Peter
The reason I added the file element is that I got an error on another module
(system.admin.inc ...) and that element made it go away.
It works now with your changes.
Thanks.
On Jan 3, 2008 8:53 PM, Peter Wolanin <pwolanin at gmail.com> wrote:
> Khalid,
>
> One thing looks wrong for sure:
>
> 'file' => 'lists.module',
>
> I'm not sure if that's causing the problem, but it instructs the menu
> system to include the module file again. 'file' should only be used
> with .inc files.
>
> Also, don't use t() anywhere - titles, etc are localized dynamically.
>
> Finally (and most importantly), the access part is wrong. Since you
> are using the defaullt callback (user_access), you can have something
> like this:
>
>
> function lists_menu() {
> $items = array();
> $items['lists'] = array(
> 'title' => 'Mailing lists',
> 'page callback' => 'drupal_get_form',
> 'page arguments' => array('lists_subscribe_form'),
> 'access arguments' => array('access content'),
> 'type' => MENU_SUGGESTED_ITEM,
> );
> return $items;
> }
>
> > ---------- Forwarded message ----------
> > From: "Khalid Baheyeldin" <kb at 2bits.com>
> > To: development at drupal.org
> > Date: Thu, 3 Jan 2008 20:27:37 -0500
> > Subject: [development] Question on Drupal 6 menus
> > This is a question for chx, but I posted it publicly so we all benefit
> from his reply.
> >
> > I found a weird problem with the menus in D6. Most probably I am missing
> something
> > obvious, but I am missing what it is.
> >
> > This does work. Note that the lists inherits from admin, and it is a
> NORMAL item.
> >
> > function lists_menu() {
> > $items = array();
> > $items['admin/lists'] = array(
> > 'title' => t('Mailing lists'),
> > 'page callback' => 'drupal_get_form',
> > 'page arguments' => array('lists_subscribe'),
> > 'access' => user_access('access content'),
> > 'type' => MENU_NORMAL_ITEM,
> > 'file' => 'lists.module',
> > );
> > return $items;
> > }
> >
> > This, which is what I want, does not show the lists path anywhere, not
> under menu
> > as disabled, nothing (I marked the changed lines with an *).
> >
> > function lists_menu() {
> > $items = array();
> > * $items['lists'] = array(
> > 'title' => t('Mailing lists'),
> > 'page callback' => 'drupal_get_form',
> > 'page arguments' => array('lists_subscribe'),
> > 'access' => user_access('access content'),
> > * 'type' => MENU_SUGGESTED_ITEM,
> > 'file' => ' lists.module',
> > );
> > return $items;
> > }
> >
> > The latter is the one needed so that the path can be enabled or disabled
> in the
> > menus as needed. This is the way it works on D5.
> >
> > What is amiss here?
> > --
> > Khalid M. Baheyeldin
> > 2bits.com, Inc.
> > http://2bits.com
> > Drupal optimization, development, customization and consulting.
> > --
> > [ Drupal development list | http://lists.drupal.org/ ]
> >
>
--
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080103/dd7974c8/attachment.htm
More information about the development
mailing list