Table of Contents

Class TreeControllerBase

Namespace
Umbraco.Cms.Web.BackOffice.Trees
Assembly
Umbraco.Web.BackOffice.dll

A base controller reference for non-attributed trees (un-registered).

public abstract class TreeControllerBase : UmbracoAuthorizedApiController, ITree
Inheritance
TreeControllerBase
Implements
ITree
Derived
Inherited Members

Remarks

Developers should generally inherit from TreeController.

Constructors

TreeControllerBase(UmbracoApiControllerTypeCollection, IEventAggregator)

protected TreeControllerBase(UmbracoApiControllerTypeCollection apiControllers, IEventAggregator eventAggregator)

Parameters

apiControllers UmbracoApiControllerTypeCollection
eventAggregator IEventAggregator

Properties

IsSingleNodeTree

public abstract bool IsSingleNodeTree { get; }

Property Value

bool

RootNodeDisplayName

The name to display on the root node

public abstract string? RootNodeDisplayName { get; }

Property Value

string

SectionAlias

public abstract string SectionAlias { get; }

Property Value

string

SortOrder

public abstract int SortOrder { get; }

Property Value

int

TreeAlias

public abstract string TreeAlias { get; }

Property Value

string

TreeGroup

public abstract string? TreeGroup { get; }

Property Value

string

TreeTitle

public abstract string? TreeTitle { get; }

Property Value

string

TreeUse

public abstract TreeUse TreeUse { get; }

Property Value

TreeUse

Methods

AddQueryStringsToAdditionalData(TreeNode, FormCollection)

The AdditionalData of a node is always populated with the query string data, this method performs this operation and ensures that special values are not inserted or that duplicate keys are not added.

protected void AddQueryStringsToAdditionalData(TreeNode node, FormCollection queryStrings)

Parameters

node TreeNode
queryStrings FormCollection

CreateRootNode(FormCollection)

Helper method to create a root model for a tree

protected virtual ActionResult<TreeNode?> CreateRootNode(FormCollection queryStrings)

Parameters

queryStrings FormCollection

Returns

ActionResult<TreeNode>

CreateTreeNode(string, string, FormCollection, string)

Helper method to create tree nodes

public TreeNode CreateTreeNode(string id, string parentId, FormCollection queryStrings, string title)

Parameters

id string
parentId string
queryStrings FormCollection
title string

Returns

TreeNode

CreateTreeNode(string, string, FormCollection?, string?, string?)

Helper method to create tree nodes

public TreeNode CreateTreeNode(string id, string parentId, FormCollection? queryStrings, string? title, string? icon)

Parameters

id string
parentId string
queryStrings FormCollection
title string
icon string

Returns

TreeNode

CreateTreeNode(string, string, FormCollection, string?, string?, bool)

Helper method to create tree nodes and automatically generate the json URL

public TreeNode CreateTreeNode(string id, string parentId, FormCollection queryStrings, string? title, string? icon, bool hasChildren)

Parameters

id string
parentId string
queryStrings FormCollection
title string
icon string
hasChildren bool

Returns

TreeNode

CreateTreeNode(string, string, FormCollection, string?, string?, bool, string)

Helper method to create tree nodes and automatically generate the json URL

public TreeNode CreateTreeNode(string id, string parentId, FormCollection queryStrings, string? title, string? icon, bool hasChildren, string routePath)

Parameters

id string
parentId string
queryStrings FormCollection
title string
icon string
hasChildren bool
routePath string

Returns

TreeNode

CreateTreeNode(string, string, FormCollection?, string?, string, bool, string?, Udi)

Helper method to create tree nodes and automatically generate the json URL + UDI

public TreeNode CreateTreeNode(string id, string parentId, FormCollection? queryStrings, string? title, string icon, bool hasChildren, string? routePath, Udi udi)

Parameters

id string
parentId string
queryStrings FormCollection
title string
icon string
hasChildren bool
routePath string
udi Udi

Returns

TreeNode

CreateTreeNode(string, string, FormCollection, string, string, string)

Helper method to create tree nodes

public TreeNode CreateTreeNode(string id, string parentId, FormCollection queryStrings, string title, string icon, string routePath)

Parameters

id string
parentId string
queryStrings FormCollection
title string
icon string
routePath string

Returns

TreeNode

CreateTreeNode(IEntitySlim, Guid, string, FormCollection?, bool)

Helper method to create tree nodes and automatically generate the json URL + UDI

public TreeNode CreateTreeNode(IEntitySlim entity, Guid entityObjectType, string parentId, FormCollection? queryStrings, bool hasChildren)

Parameters

entity IEntitySlim
entityObjectType Guid
parentId string
queryStrings FormCollection
hasChildren bool

Returns

TreeNode

CreateTreeNode(IUmbracoEntity, Guid, string, FormCollection, string, bool)

Helper method to create tree nodes and automatically generate the json URL + UDI

public TreeNode CreateTreeNode(IUmbracoEntity entity, Guid entityObjectType, string parentId, FormCollection queryStrings, string icon, bool hasChildren)

Parameters

entity IUmbracoEntity
entityObjectType Guid
parentId string
queryStrings FormCollection
icon string
hasChildren bool

Returns

TreeNode

GetMenu(string, FormCollection)

The action called to render the menu for a tree node

public Task<ActionResult<MenuItemCollection?>> GetMenu(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

Task<ActionResult<MenuItemCollection>>

GetMenuForNode(string, FormCollection)

Returns the menu structure for the node

protected abstract ActionResult<MenuItemCollection> GetMenuForNode(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

ActionResult<MenuItemCollection>

GetMenuForNodeAsync(string, FormCollection)

Returns the menu structure for the node

protected virtual Task<ActionResult<MenuItemCollection>> GetMenuForNodeAsync(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

Returns

Task<ActionResult<MenuItemCollection>>

Remarks

If overriden, GetMenuForNode will not be called

GetNodes(string, FormCollection?)

The action called to render the contents of the tree structure

public Task<ActionResult<TreeNodeCollection?>> GetNodes(string id, FormCollection? queryStrings)

Parameters

id string
queryStrings FormCollection

All of the query string parameters passed from jsTree

Returns

Task<ActionResult<TreeNodeCollection>>

JSON markup for jsTree

Remarks

We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end to the back end to be used in the query for model data.

GetRootNode(FormCollection?)

Returns the root node for the tree

public Task<ActionResult<TreeNode?>> GetRootNode(FormCollection? queryStrings)

Parameters

queryStrings FormCollection

Returns

Task<ActionResult<TreeNode>>

GetTreeNodes(string, FormCollection)

The method called to render the contents of the tree structure

protected abstract ActionResult<TreeNodeCollection> GetTreeNodes(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

All of the query string parameters passed from jsTree

Returns

ActionResult<TreeNodeCollection>

Remarks

We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end to the back end to be used in the query for model data.

GetTreeNodesAsync(string, FormCollection)

The method called to render the contents of the tree structure

protected virtual Task<ActionResult<TreeNodeCollection>> GetTreeNodesAsync(string id, FormCollection queryStrings)

Parameters

id string
queryStrings FormCollection

All of the query string parameters passed from jsTree

Returns

Task<ActionResult<TreeNodeCollection>>

Remarks

If overriden, GetTreeNodes will not be called We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end to the back end to be used in the query for model data.

IsDialog(FormCollection)

If the request is for a dialog mode tree

protected bool IsDialog(FormCollection queryStrings)

Parameters

queryStrings FormCollection

Returns

bool