Sitecore - Hide the button in the feed

I created a context feed for a specific content item. I have two buttons that will "advance" or "lower" an element to a certain category (there can only be one in a section).

Is it possible to hide one of the buttons based on the state of the content in some code? I understand how to associate with a Click event, but I was wondering if there was any kind of loading event for a custom access ribbon.

+4
source share
1 answer

It seems I can use the same class that inherits from Command to override the QueryState method. This is called when the buttons load, and I can check there and return CommandState.Hidden if the button should not be displayed

 public override CommandState QueryState(CommandContext context) { var item = context.Items[0]; return item.Fields["Spotlight"].Value == "" ? CommandState.Hidden : base.QueryState(context); } 
+6
source

All Articles