[wp-trac] [WordPress Trac] #12718: Better structure for admin $menu

WordPress Trac wp-trac at lists.automattic.com
Fri Mar 26 01:05:37 UTC 2010


#12718: Better structure for admin $menu
-------------------------+--------------------------------------------------
 Reporter:  scribu       |       Owner:     
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  3.1
Component:  General      |     Version:     
 Severity:  normal       |    Keywords:     
-------------------------+--------------------------------------------------
 Currently, the global $menu variable is one big linear array:

 {{{
 $menu = array(
     [2] => array('Dashboard', ...
     [4] => array('', 'read', 'separator1', ...),
     [5] => array('Posts', ...)
     ...
 )
 }}}

 To allow plugins to add a menu item at the end of a group, we use a bunch
 of additional global variables that remember the last element in each
 group.

 It's very low level.

 Things would be a lot easier if groups were built in:

 {{{
 $menu = array(
     'dashboard' => array(
         [5] => array('Dashboard', ...
     ),

     'object' => array(
         [5] => array('Posts', ...)
         [10] => array('Media', ...)
         ...
     ),

     'utility' => array(
         [5] => array('Posts', ...)
         [10] => array('Media', ...)
         ...
     ),
 )
 }}}

 With this structure, separators could be inserted automatically in the
 right places. Also, you wouldn't have to worry about adding 'menu-top-
 first' and 'menu-top-last' classes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12718>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list