Custom section tree nodes and routes - Umbraco

If you haven't already created a custom section within Umbraco, I suggest that youfollow this amazing tutorial by Markusit's a two part tutorial on setting upt he basics of a custom section.

Lets start by discussing the structure of a custom section and assuming you've already got the section set up in Umbraco and you now want to add nodes to it, we'll look at how the nodes within the left panel get called and what parameters you can give them.

Defining a TreeController

A TreeController should be defined as per below, but make sure to check out the tutorial I've linked above to learn how to make it functional.

Node parameters

The minimum required parameters given to the method is everything up to and including title.

Defining more than one TreeController class

Implementing more than one tree controller is easy, make sure that the reference the same package name, butchange the tree aliasas defined in the above example as myfirsttreealias.

Why define more than one TreeController?

Multiple tree controllers are useful if you're displaying data in two or more categories/types, for example, I might have a motorbike tree and a car tree, some data will be similar, but ultimately, I want the data to display differently and post to different locations. Whilst this is possible with a single TreeController, adding a second simplifies things as we can now define different angular controllers and layout files for our nodes under different folders.

Umbraco will expect your default files such ascreate.html, edit.html and delete.htmlto be located under a folder inApp_Plugins such as the following:

App_Plugins/mypackagename/backoffice/myfirsttreealias/create.html

Defining custom routes

Notice that in the above example, I defined a new node for our tree structure as follows: