4
需要添加“发布”功能到页面编辑器,项目编辑部分。 (在“更多”部分将是理想的)。我怎样才能做到这一点?Sitecore页面编辑器 - 如何扩展页面编辑器项目编辑面板
需要添加“发布”功能到页面编辑器,项目编辑部分。 (在“更多”部分将是理想的)。我怎样才能做到这一点?Sitecore页面编辑器 - 如何扩展页面编辑器项目编辑面板
首先,你需要创建一个命令类。最简单的版本是:
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 item
Publish related item
此项目的Click
属性的项目my:publish
Header
,Icon
,Tooltip
)我们可以在不改变任何代码的情况下实现它。
<command name="webedit:publish" type="Sitecore.Shell.Framework.Commands.PublishItem,Sitecore.Kernel" />
在Commands.config文件中添加上面的条目。该文件在包含文件夹中可用。
感谢
Fenil