MenuLink trees

As I mentioned in the section about menus, menu links are stored hierarchically inside a menu. This hierarchy is represented via a menu link tree. There are a number of key players here we should go over.

We have the MenuLinkTree service, which is the interface used to load and prepare the tree of a certain menu. The loading is deferred to the MenuTreeStorage service, which does so on the basis of a MenuTreeParameters object that contains metadata on certain restrictions to be applied on the menu links that are loaded. We will see some examples of this a bit later.

What comes out of the MenuLinkTree service is an array of MenuLinkTreeElement objects. These are essentially value objects that wrap the MenuLinkInterface plugins and that provide some extra data about their placement in the tree they are loaded in. One such important piece of information is the subtree (the array of MenuLinkTreeElement objects that are below it).