[wp-trac] [WordPress Trac] #19371: As of 3.3beta2 WP_Admin_Bar no longer provides a way to access attributes of existing menu items
WordPress Trac
wp-trac at lists.automattic.com
Sat Dec 3 02:24:55 UTC 2011
#19371: As of 3.3beta2 WP_Admin_Bar no longer provides a way to access attributes
of existing menu items
--------------------------+--------------------------
Reporter: willshouse | Owner: koopersmith
Type: defect (bug) | Status: accepted
Priority: high | Milestone: 3.3
Component: Admin Bar | Version: 3.3
Severity: minor | Resolution:
Keywords: has-patch |
--------------------------+--------------------------
Changes (by koopersmith):
* keywords: => has-patch
* status: assigned => accepted
Comment:
Okay! Simply making {{{get_nodes()}}} public or protected is not a
reasonable solution without a few other changes — it leaves too many doors
open.
There are three stages within WP_Admin_Bar:
1. '''Pre-bind:''' This is where we use {{{add_node()}}} and friends.
Nodes are represented as a flat list.
2. '''Binding:''' Here, we transform the list of nodes into the tree that
we'll use to render the toolbar. This should be contained entirely within
the internal {{{_bind()}}} method.
3. '''Post-bind:''' Now we render the tree, stemming from the root node.
The [http://core.trac.wordpress.org/attachment/ticket/19416/19416.diff
patch] on #19416 fixes a handful of things:
* #19416 (of course).
* {{{get_nodes()}}} is now public.
* {{{add_node()}}} is now the canonical way to change a node's value.
{{{get_node()}}} and {{{get_nodes()}}} return clones of each node.
* The binding logic to create containers moved from {{{_render_group()}}}
to {{{_bind()}}}. This is critical and makes rendering much simpler.
* The various node-manipulation functions short-circuit after
{{{_bind()}}} is called. The {{{$root}}} node (returned by {{{_bind()}}})
becomes the only way of manipulating the tree.
This hardens the three stages, and will make working with the new admin
bar API considerably less buggy.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19371#comment:35>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list