Adding a custom command to item context menu
The context menu is designed to increase the efficiency of content authors. The requirements may vary for content authors across different organizations.
In this recipe, we will create a menu item in the context menu of a Sitecore item that will display the number of children that the selected item contains. In the same way, you will be able to create a command button for the Content Editor and Experience Editor ribbons as well.
How to do it…
We will first create a Command
class:
- In the
SitecoreCookbook
project, create aGetChildCount
class in theCommands
folder. Inherit the class fromSitecore.Shell.Framework.Commands.Command
. - Override the
Execute()
method of theCommand
class to apply a command action ...
Get Sitecore Cookbook for Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.