Acccess CreateTreeNode in TreeNodesRenderingNotification #11425
Replies: 3 comments 17 replies
-
It seems when using If I register
But then cause error when logging into backoffice: @bergmania is there something we should register to use |
Beta Was this translation helpful? Give feedback.
-
It found a similar example here:
|
Beta Was this translation helpful? Give feedback.
-
This inject
Maybe there's a workaround to get an existing tree (in this case Vendr tree). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In Umbraco v8 with
TreeControllerBase.TreeNodesRendering
event we had access toCreateTreeNode()
method, which was available viasender
:This seems no longer to be the case with
TreeNodesRenderingNotification
notification in v9:Instead we need to inject
UmbracoApiControllerTypeCollection
andIUrlHelper
which has two extension methodsGetTreeUrl()
andGetMenuUrl()
.https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Trees/UrlHelperExtensions.cs#L44-L65
It would be great if we could access the
CreateTreeNode()
and maybe alsoCreateRootNode()
like when creating a regularTreeController
, which inherit these methods fromTreeControllerBase
:https://github.com/umbraco/Umbraco-CMS/blob/v9/contrib/src/Umbraco.Web.BackOffice/Trees/TreeControllerBase.cs#L204-L218
In the example above it inject a tree node inject the existing Vendr tree.
Could we either inject a service or inherit these methods ... or access these from
TreeNodesRenderingNotification
parameter?Beta Was this translation helpful? Give feedback.
All reactions