Dha*_*777 4 sitecore page-editor
需要在页面编辑器,项目编辑部分添加"发布"功能.(在"更多"部分下是理想的).我怎样才能做到这一点?

Mar*_*lak 10
首先,您需要创建一个命令类.最简单的版本是:
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]);
}
}
}
Run Code Online (Sandbox Code Playgroud)
在Sitecore.config(或Commands.config)中注册新命令:
<configuration>
<sitecore>
<commands>
<command name="my:publish" type="my.assembly.namespace.Publish,my.assembly"/>
</commands>
</sitecore>
</configuration>
Run Code Online (Sandbox Code Playgroud)
然后:
/sitecore/content/Applications/WebEdit/Common Field Buttons/Edit related itemPublish related itemClick将此项目的属性设置为my:publishHeader,Icon,Tooltip)