Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rob Shaw 37 posts 170 karma points c-trib
    Dec 21, 2019 @ 20:24
    Rob Shaw
    0

    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

  • Marc Goodson 2157 posts 14434 karma points MVP 9x c-trib
    Dec 23, 2019 @ 20:57
    Marc Goodson
    100

    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

  • Rob Shaw 37 posts 170 karma points c-trib
    Jan 07, 2020 @ 09:41
    Rob Shaw
    0

    Hi Marc,

    Thanks for that you're a star! I'm on my way to creating custom tree actions now woohoo!

    Thanks again, Rob

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies