Need to add "publish" feature to the page editor, item editing section. (Under the "More" section would be ideal). How can I do this?
First you need to create a command class. The simplest version would be:
using System;
using Sitecore.Shell.Applications.WebEdit.Commands;
using Sitecore.Shell.Framework;
using Sitecore.Shell.Framework.Commands;
namespace my.assembly.namespace
{
[Serializable]
public class Publish : WebEditCommand
{
public override void Execute(CommandContext context)
{
if (context.Items.Length != 1)
return;
Items.Publish(context.Items[0]);
}
}
}
Register new command in Sitecore.config
(or Commands.config
):
<configuration>
<sitecore>
<commands>
<command name="my:publish" type="my.assembly.namespace.Publish,my.assembly"/>
</commands>
</sitecore>
</configuration>
Then:
/sitecore/content/Applications/WebEdit/Common Field Buttons/Edit related item
Publish related item
Click
property of this item to my:publish
Header
, Icon
, Tooltip
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With