API / Minn\Front / ToolbarTree

ToolbarTree final class

Minn\Front\ToolbarTree · public/minn/src/Minn/Front/ToolbarTree.php · 90 lines

WP_Admin_Bar's nodes bound into the tree they print as, as the reference binds them (probe admin-bar): each gains its children and its type; an item's children go into its "-default" group, made when the first one arrives; a group inside a group sits next to it in a "-container", put where the outer group was; a node whose parent is missing is left out. The bar's own node accessors are used throughout, so a subclass that overrides them still sees every node it is asked for.

Constants and properties

privateClosure $get

Promoted from the constructor.

privateClosure $set

Promoted from the constructor.

Public

new__construct(Closure $get, Closure $set)#
$get\Closure(string): ?objectthe bar's _get_node
$set\Closure(array<string, mixed>): voidthe bar's _set_node
staticbind(array $nodes, Closure $get, Closure $set): ?object#

The root of the bound tree, for nodes (the bar's, a root among them) reached through the bar's accessors.

$nodesarray<string, object>
$get\Closure(string): ?object
$set\Closure(array<string, mixed>): void

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateplace(object $node): void#

A node into its parent's children, through a default group or a container when it needs one.

privatedefaultGroup(object $parent, string $groupClass): object#

The group an item's child items go into, made the first time.

privatecontainer(object $group): object#

The container a group shares with the groups inside it, put where the group was.