Sitecore页面编辑器

编程入门 行业动态 更新时间:2024-10-08 20:35:08
本文介绍了Sitecore页面编辑器-如何扩展页面编辑器项目编辑面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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]); } } }

在Sitecore.config(或Commands.config)中注册新命令:

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>

然后:

  • 登录到 Sitecore桌面
  • 将数据库切换到核心
  • 重复/sitecore/content/Applications/WebEdit/Common Field Buttons/Edit related item
  • 将新项目重命名为Publish related item
  • 将此项目的Click属性设置为my:publish
  • 更改项目的其他属性(Header,Icon,Tooltip)
  • 将数据库切换回 master
  • 打开页面编辑器并测试新命令(它应打开标准发布弹出窗口,并以相关项 ID 作为URL中的参数).
  • Login to Sitecore Desktop
  • Switch database to core
  • Duplicate /sitecore/content/Applications/WebEdit/Common Field Buttons/Edit related item
  • Rename new item to Publish related item
  • Set Click property of this item to my:publish
  • Change other properties of the item (Header, Icon, Tooltip)
  • Switch database back to master
  • Open Page Editor and test the new command (it should open the standard publishing popup with the related item ID as a parameter in URL).
  • 更多推荐

    Sitecore页面编辑器

    本文发布于:2023-05-31 14:00:39,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/393028.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:编辑器   页面   Sitecore

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!