需要在页面编辑器,项目编辑部分添加“发布”功能。(在“更多”部分下将是理想的)。我怎样才能做到这一点?

首先,您需要创建一个命令类。最简单的版本是:
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]);
}
}
}
Sitecore.config在(或)中注册新命令Commands.config:
<configuration>
<sitecore>
<commands>
<command name="my:publish" type="my.assembly.namespace.Publish,my.assembly"/>
</commands>
</sitecore>
</configuration>
然后:
/sitecore/content/Applications/WebEdit/Common Field Buttons/Edit related itemPublish related itemClick将此项目的属性设置为my:publishHeader, Icon, Tooltip)我们可以在不更改任何代码的情况下实现它。
<command name="webedit:publish" type="Sitecore.Shell.Framework.Commands.PublishItem,Sitecore.Kernel" />
在 Commands.config 文件中添加上述条目。该文件在包含文件夹中可用。
谢谢
茴香