I have created a custom section with it's own tree, so far so good. However I am struggling to find any examples/documentation on how to hook into/extend tree node actions.
I have got as far as being able to show a create & delete option in the tree node context menu. What I am looking for is to be able to run some custom code when they select either of these options.
I was wondering if any one out there has any code examples I could look at or point me towards any articles that could help?
Custom tree actions
Hi all,
I have created a custom section with it's own tree, so far so good. However I am struggling to find any examples/documentation on how to hook into/extend tree node actions.
I have got as far as being able to show a create & delete option in the tree node context menu. What I am looking for is to be able to run some custom code when they select either of these options.
I was wondering if any one out there has any code examples I could look at or point me towards any articles that could help?
Thanks! Rob
Hi Rob
The trick is to create an angularJS view with a name matching the alias of the action that you've added to the MenuItemCollection:
https://our.umbraco.com/Documentation/Extending/Section-Trees/trees#responding-to-tree-actions
then your view can reference an angularJS Controller, and here you can write your custom code.
Have a look at plugins which implement a custom menu action for inspiration eg PageNotFoundManager:
https://github.com/TimGeyssens/UmbracoPageNotFoundManager/blob/dev-v8/PageNotFoundManager/App_Plugins/PageNotFoundManager/Backoffice/Dialogs/dialog.html
Although there is a good article on 24 days in Umbraco that touches upon custom sections: https://24days.in/umbraco-cms/2019/dashboards-plus-migration/dashboards-and-sections/
regards
Marc
Hi Marc,
Thanks for that you're a star! I'm on my way to creating custom tree actions now woohoo!
Thanks again, Rob
is working on a reply...