Copied to clipboard

Flag this post as spam?

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


  • Martin Fenton 2 posts 22 karma points
    Feb 13, 2015 @ 15:59
    Martin Fenton
    0

    Custom context menu / menu state / current node id

    I have the following development on Umbraco 7:

    1. Custom menu item added to the content tree
    2. Menu item points to a new custom plugin in App_Plugins
    3. Require access to the current selected node id in order to execute the controller code for the plugin.

    The problem is that its not easy to get the current "selected" not id - i.e. the node is that the user right clicked on.

    I can use either the editorState or the $routeParams to get the current "active" (i.e. highlighted in blue). However, that may not necessarily be the actual menu item that the user right clicked on.

    After digging around I have now found that the following will give me access to the correct menu state: appState.getMenuState("currentNode")

    Is there any other way to get access to the current selected node? It this the best way?

    Thanks

    Martin

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jul 26, 2016 @ 14:33
    Morten Bock
    0

    Thanks to this hint, I managed to dig around in the source a bit.

    I think the "official" way to get it is to use:

    $scope.currentNode
    
Please Sign in or register to post replies

Write your reply to:

Draft