In Umbraco 7 we could move a tree to another section by updating the trees.config file. In v8 it looks like trees are now tied to a specific section via the Tree attribute on the tree's controller.
I was looking at moving a tree by implementing a custom tree controller which inherited from the tree controller I want to move. My plan was to then remove the original tree from the tree collection builder and add my new tree, however the tree collection builder doesn't have a remove method (other collection builders, e.g. the dashboard collection builder, do have a Remove method). Even if this did work, it feels like a complicated way of doing something which was a simple config change before.
Are we now unable to move trees in Umbraco 8, or should I be looking at a different approach here?
I know this question was for Umbraco 8, but in Umbraco 9.1+ it is possible to remove a tree node using a composer and the RemoveTreeController() method.
public class TreeComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder.Trees().RemoveTreeController<ContentBlueprintTreeController>();
}
}
and then add a new tree controller inheriting ContentBlueprintTreeController, which is auto-registered because of the Tree attribute:
Before Umbraco 9.1 you could use TreeNodesRendering (v8) and TreeNodesRenderingNotification (v9) to remove/hide a specific tree.
I have also suggested Content Templates should be added to content tree as content editors also need to edit and delete these, but we don't want to grant them full accesss to settings section:
https://github.com/umbraco/Umbraco-CMS/discussions/11743
Maybe it should even be a granular permission per user group.
Moving trees to another section
Hello,
In Umbraco 7 we could move a tree to another section by updating the trees.config file. In v8 it looks like trees are now tied to a specific section via the Tree attribute on the tree's controller.
I was looking at moving a tree by implementing a custom tree controller which inherited from the tree controller I want to move. My plan was to then remove the original tree from the tree collection builder and add my new tree, however the tree collection builder doesn't have a remove method (other collection builders, e.g. the dashboard collection builder, do have a Remove method). Even if this did work, it feels like a complicated way of doing something which was a simple config change before.
Are we now unable to move trees in Umbraco 8, or should I be looking at a different approach here?
I know this question was for Umbraco 8, but in Umbraco 9.1+ it is possible to remove a tree node using a composer and the
RemoveTreeController()
method.and then add a new tree controller inheriting
ContentBlueprintTreeController
, which is auto-registered because of theTree
attribute:I may also be possible to inject the tree using
TreeNodesRenderingNotification
: https://our.umbraco.com/Documentation/Extending/Section-Trees/trees#treenodesrenderingnotification and in v8TreeNodesRendering
event: https://our.umbraco.com/Documentation/Extending/Section-Trees/trees-v8#treenodesrenderingBefore Umbraco 9.1 you could use
TreeNodesRendering
(v8) andTreeNodesRenderingNotification
(v9) to remove/hide a specific tree.I have also suggested Content Templates should be added to content tree as content editors also need to edit and delete these, but we don't want to grant them full accesss to settings section: https://github.com/umbraco/Umbraco-CMS/discussions/11743
Maybe it should even be a granular permission per user group.
is working on a reply...