Copied to clipboard

Flag this post as spam?

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


  • Simon Justesen 74 posts 193 karma points
    May 01, 2017 @ 11:45
    Simon Justesen
    0

    [Umbraco 7.5.12] Can't load custom plugin menu tree

    So, I've been developing this small booking plugin lately, it's ready for deployment and decided to switch from debug=true to false. Boom it went, and my menu tree disappeared. Even now, if I switch back to web.config -> debug=false it's still gone

    The exception thrown states:

    Received an error from the server. An error occured. Could not render a tree for type bookings
    

    This is my menu tree code - as you see, pretty standard code snippet:

    [PluginController("Bookings")]
    [Tree("bookings", "bookings", "Bookings")]
    public class BookingMenuTreeController : TreeController
    {
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            //check if we're rendering the root node's children
            if (id == Constants.System.Root.ToInvariantString())
            {
                var tree = new TreeNodeCollection
                {
                    CreateTreeNode("1", id, null, "Bookinger"), 
                };
                return tree;
            }
            //this tree doesn't suport rendering more than 1 level
            throw new NotSupportedException();
        }
    
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();
           // menu.AddMenuItem(new MenuItem("create", "Create"));
            return menu;
        }
    }   
    

    I initialize the menu tree on application startup like this:

    public class Startup : ApplicationEventHandler {
    
       protected const string BookingSectionAlias = "bookings";
    
        protected override void ApplicationStarted(UmbracoApplicationBase umbraco, ApplicationContext context) {
            Section section = context.Services.SectionService.GetByAlias(BookingSectionAlias);
            if (section != null) return;
    
            context.Services.SectionService.MakeNew("Bookings", BookingSectionAlias, "icon-newspaper");
    
        }
    

    Custom tree is present in tree.config. I'm uncertain where to look next. Any ideas? [Umbraco 7.5.12]

    Thanks, Simon

  • 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