Last week, I asked Lewis Goulden — a friend and former colleague — to name one thing in Sitecore he would like to learn or know more about. His answer was knowing how to add menu options to the Item context menu — particularly the ‘Publish Now’ and ‘Publish Item’ menu options found in the Publish ribbon.
I remembered reading a few blog articles in the past articulating how one would accomplish this. I needed to dig to find any of these articles.
After googling — yes googling is a verb in the English language — a few times, I found an article by John West discussing how to do this and another by Aboo Bolaky. I had also discovered this on pages 259-260 in John West’s book Professional Sitecore Development.
Instead of passing these on to Lewis and wishing him the best of luck in his endeavours augmenting his context menu — definitely not a cool thing to do to a friend — I decided to capture how this is done in this post, and share this with you as well.
Plus, this article sets the cornerstone for part two: augmenting the item context menu using a custom command and pipeline.
Here’s what the context menu looks like unadulterated:
My basic goal is to add a new ‘Publishing’ fly-out menu item containing ‘Publish Now’ and ‘Publish Item’ submenu options betwixt the ‘Insert’ and ‘Cut’ menu options.
In other words, I need to go find the ‘Publish Now’ and ‘Publish Item’ menu items in the core database and add these to the Item context menu.
So, I had to switch over to the core database and fish around to find out the command names of the ‘Publish Now’ and ‘Publish Item’ menu items.
First, I looked at the Publish ribbon (/sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default/Publish):
The Publish ribbon helped me hone in closer to where I should continue to look to find the publishing menu items.
Next, I went to the Publish strip:
The Publish strip pretty much tells me I have to keep on digging. Now, I have to go take a look at the Publish chunk.
In the Publish chunk, I finally found the ‘Publish Now’ menu button:
I made sure I copied its click field value — we’ll be needing it when we create our own ‘Publish Now’ menu item.
I then navigated to /sitecore/content/Applications/Content Editor/Menues/Publish to snag the command name of the ‘Publish Item’ menu option:
Now, I have all I need to create my own ‘Publishing’ fly-out menu item and its ‘Publish Now’ and ‘Publish Item’ submenu options.
I then went to /sitecore/content/Applications/Content Editor/Context Menues/Default and added a new Item named ‘Divider’ — using the /sitecore/templates/System/Menus/Menu divider template — after the Insert menu option, and created my ‘Publishing’ fly-out menu item using the /sitecore/templates/System/Menus/Menu item template.
Thereafter, I created my ‘Publish Item’ menu item using the same template as its parent ‘Publishing’. I then put the command name for the ‘Publish Item’ menu option found previously into my item’s Message field:
Next, I created my ‘Publish Now’ menu item using the same template as its parent and sibling. I put in the ‘Publish Now’ menu item’s Message field the command name for the ‘Publish Now’ menu option found during my expedition above:
Now, let’s take this for a test drive. I switched back to the master database and navigated to my Home node. I then right-clicked:
As you can see, the ‘Publishing’ fly-out menu appears with its publishing submenu options. Trust me, both menu items do work. 🙂
All of this without any code whatsoever!
In part 2 of this article, I will step through building a custom command coupled with a custom pipeline that compose the logic for a custom menu item for the Item context menu that copies all subitems of an ancestor item to a selected destination.
Happy coding and have a Sitecorelicious day! 🙂
[…] menu — for more information on adding to the context menu for items, please check out my post that shows you how to do this — so I created new menu option in the context menu for items in […]
[…] got the creative juices flowing. Why not create new item context menu options — check out part 1 and part 2 of my post discussing how one would go about augmenting the item context menu, and also […]
[…] buttons in the core database. If you are unfamiliar with how this is done, please take a look at my first and second posts on augmenting the item context menu to see how this is […]
[…] omitted a screenshot on how this is done; If you would like to see how this is done, please see part 1 and part 2 of my post showing how to add to the item context […]
[…] menu in the core database. For more information on adding to the item context menu, please see part one and part two of my post showing how to do […]
[…] menu in the core database. For more information on adding to the item context menu, please see part one and part two of my post showing how to do […]
[…] omitted how I’ve done this. If you would like to learn how to do this, check out my first and second posts on adding to the item context […]
[…] dialog. From just the one menu itemPublish by Aboo Bolaky back in 2009 to the one written back in 2012 by Mike Reynolds. I went ahead and implemented the full Publishing menu by including the Publishing […]