Copied to clipboard

Flag this post as spam?

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


  • npack 59 posts 335 karma points
    Jan 16, 2024 @ 16:26
    npack
    0

    Possible to have multiple TreeControllers/Sections per Plugin?

    I read through and followed the directions for creating a new section and tree in a separate plugin project. (https://docs.umbraco.com/umbraco-cms/extending/section-trees/trees)

    It worked fine, but when I tried to add a second section with its own tree to the same plugin it seemed I could get one or the other to work but not both. At times it seemed that clicking one section would send the user to the other, almost bleeding between the two. Is there some fundamental constraint that limits us to having one section or tree per plugin?

    Here is how I set up one of them, with everywhere that says 'blogs' replaced by a different string for the second implementation enter image description here

    enter image description here

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Jan 16, 2024 @ 16:39
    Marc Goodson
    100

    Hi npack

    The PluginController decoration is to help with the routing of requests in the Umbraco backoffice, particularly if you are going to release your code as a plugin or package.

    Essentially you might create a TreeController that clashes with the name of one provided by a third-party package so Umbraco gives this mechanism to allow you to isolate your custom Tree under a custom path.

    So if you are creating two different TreeControllers for different purposes, then yes, I'd expect them to have different 'plugincontroller' names, one for each purpose, but those two TreeControllers could be release as part of the same package if that makes sense!

    if you have two TreeControllers with the same plugincontroller name then the routing of the request will likely intefere with each other.

    regards

    Marc

  • npack 59 posts 335 karma points
    Jan 16, 2024 @ 16:46
    npack
    0

    Thanks Mark,

    I did try with each TreeController's '[PluginController]' attribute configured with a different name and still had bleed over issues. Maybe I'll revisit this again -- in the meantime I can just keep one plugin assembly per section. It is likely I did something odd since this is my first plugin.

  • Marc Goodson 2157 posts 14431 karma points MVP 9x c-trib
    Jan 16, 2024 @ 16:51
    Marc Goodson
    0

    Hi npack

    fingers crossed, excited now for when the plugin is released!

    regards

    marc

Please Sign in or register to post replies

Write your reply to:

Draft