[drupal-devel] menu system idea
Adrian Rossouw
adrian at bryght.com
Sat Jun 18 22:02:09 UTC 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Instead of defining menu's as we do now (using 'path' => ) , why
don't we skip the entire building a tree thing and just define the
menu entries as trees to begin with?
ie :
$menu['node']['add']['blog'][ITEM] = array(title => t('blog entry'),
access => user_access('edit own blog'));
$menu['blog'][ITEM] = array(title => t('blogs'), callback =>
'blog_page', access => user_access('access content'), type =>
MENU_SUGGESTED_ITEM);
(ITEM would just be a define('ITEM', '__item') to avoid namespace
conflicts.)
This would mean we could 'build' the menu, just by :
$_menu = array();
foreach (module_implements('menu') as $module) {
$_menu = array_merge_recursive($_menu, module_invoke($module,
'menu'));
}
Furthermore, we could solve the multiple menu tree requirement by
defining menu items for the primary navigation such as :
$menu[PRIMARY]['node']['add']['blog'] = array(title => t('new
post!'), access => user_access('edit own blog'));
It might also simplify the menu system to the point where mere
mortals can understand it =)
- --
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCtJp7gegMqdGlkasRAsY/AJwJARgxJz3zgNQnySSM54XqYi3bDgCgo7ml
ewl/EPrMJRsafBJrqQdQxaA=
=wlf3
-----END PGP SIGNATURE-----
More information about the drupal-devel
mailing list