Copied to clipboard

Flag this post as spam?

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


  • blackhawk 313 posts 1368 karma points
    Sep 14, 2017 @ 20:56
    blackhawk
    0

    How can we hide the notifications option from the actions menu?

    When you go into a content node, the top right corner has an actions menu. I would like to completely hide the "Notifications" menu item from this actions menu, as I feel that may confuse some writers / editors while working. What would be the easiest way to remove it from the menu?

    Within my en_us.xml file i see...

    <key alias="notify">Notifications</key>
    

    But unsure if this is a starting point.

    Also... I tried implementing the following class and building my project again, but no luck....

    using System.Linq;
    using Umbraco.Web.Trees;
    
    namespace umb04.CustomClasses
    {
        public class RemoveActionMenuItems
        {
            private void ContentTreeController_MenuRendering(TreeControllerBase sender, MenuRenderingEventArgs e)
            {
                e.Menu.Items.Remove(e.Menu.Items.Where(x => x.Alias == "notify").FirstOrDefault());
            }
        }
    }
    

    Using Umbraco 7.6.6.

    Thanks for any advice!

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Sep 15, 2017 @ 07:00
    Kevin Jump
    100

    Hi

    the second method (the class) will work if you put it into an Application Handler and register for the Menu Rendering event.

    public class RemoveActionMenuItems: ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            ContentTreeController.MenuRendering += ContentTreeController_MenuRendering;
        }
    
        private void ContentTreeController_MenuRendering(TreeControllerBase sender, MenuRenderingEventArgs e)
        {
            e.Menu.Items.Remove(e.Menu.Items.Where(x => x.Alias == "notify").FirstOrDefault());
        }
    }
    
  • blackhawk 313 posts 1368 karma points
    Sep 15, 2017 @ 13:26
    blackhawk
    0

    Thank you that worked! Where can I learn about other commands (other than ContentTreeController) in which I can use within the protected override void function? This is all new to me, but I'm learning.

    Thanks again!

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Sep 15, 2017 @ 13:42
    Kevin Jump
    1

    Hi

    the documentation has an overview of the application Event Handler events

    https://our.umbraco.org/Documentation/Reference/Events/Application-Startup

    and there is some documentation about events too

    https://our.umbraco.org/documentation/Reference/Events/

    In general most of the time everything is in OnStarted (unless you are doing something advanced) and in general you will probably find yourself using the content events a lot. - because they happen when content is published.

Please Sign in or register to post replies

Write your reply to:

Draft