Copied to clipboard

Flag this post as spam?

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


  • jake williamson 207 posts 872 karma points
    Aug 10, 2020 @ 08:19
    jake williamson
    0

    removing a tree node from the settings section in the backoffice?

    hey out there,

    i've written a plugin that extends the the log viewer that ships umbraco 8.

    ideally i'd like to either hide or remove the log viewer entry in the settings tree:

    remove log viewer entry from the settings section of the backoffice

    is this possible? it feels like that something that could possibly be done via a composer:

    tree options

    however i can't find anything that would remove an item...

    is this possible?!

    any suggestions would be grand ;)

    cheers,

    jake

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Aug 10, 2020 @ 10:15
    Owain Williams
    100

    Hey Jake, Not tried this myself but could you do something like : https://our.umbraco.com/documentation/extending/section-trees/trees#treenodesrendering

    And target if the node starts with Log then remove it. Once you have done that then you could add your own custom one?

  • jake williamson 207 posts 872 karma points
    Aug 10, 2020 @ 23:21
    jake williamson
    3

    you sir, are a genius ;)

    this is what i ended up doing:

    public class TreeEvents : IComponent
    {
        public void Initialize()
        {
            TreeControllerBase.RootNodeRendering += TreeControllerBase_RootNodeRendering;
        }
    
        public void Terminate() { }
    
        void TreeControllerBase_RootNodeRendering(TreeControllerBase sender, TreeNodeRenderingEventArgs e)
        {
            if (sender.TreeAlias == "logViewer")
            {
                e.Node.CssClasses.Add("hide-section-tree");
            }
        }
    }
    

    the umbraco css does have a .hide class however adding it to the css classes for the node doesn't actually hide the item:

    css classes

    so i added my own css file with the following class:

    .hide-section-tree {
        display: none !important;
    }
    

    and bingo, we have a winner!

    log viewer removed

    the crazy thing is i swear i'd looked at that page a 100 times and not twigged that bit of code...

    thanks again for the suggestion, have a good one ;)

    jake

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Aug 11, 2020 @ 07:01
    Owain Williams
    1

    Brilliant - glad you were able to find a way to make it work. Looking forward to seeing what your updated logger does :)

    O.

  • jake williamson 207 posts 872 karma points
    Aug 11, 2020 @ 07:31
    jake williamson
    1

    i've just finished the last items - the repo is available here:

    https://github.com/ribsdigital/UmbLogExporter/tree/develop

    it's a log viewer replacement which adds an export to excel function and a few other tweaks.

    UmbLogExporter Default View

    UmbLogExporter Search View

    there's still a bit of testing to go but i think it should be releasable tomorrow ;)

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Aug 11, 2020 @ 07:44
    Owain Williams
    0

    Nice and great to see it's open source too. I'll check it out :) Great work.

    h5yr!

  • Mahmoud 15 posts 85 karma points
    Oct 23, 2022 @ 11:33
    Mahmoud
    0

    There is an extension method to remove tree nodes, This is working perfectly fine without the need for css. Also, It will not render this tree item at all.

    enter image description here

  • fatmazayed 41 posts 122 karma points
    Oct 18, 2023 @ 06:38
    fatmazayed
    0

    i want to remove item from setion menu enter image description here

    i want to remove workflow item from sections menu for all groups even admin

Please Sign in or register to post replies

Write your reply to:

Draft