Sitecore Blog: @sitecorejohn blog

Sitecore CMS 6.4: Page Editor Commands

By John West, October 14, 2010 | Rating:  | Comments (6)

Screen shot of Page Editor showing custom reset field command

This blog post describes how you can add commands to placeholders, renderings, fields, and markup elements in the Page Editor using version 6.4 of Sitecore's ASP.NET CMS. For more information about Sitecore CMS 6.4, see my previous blog post, Sitecore CMS 6.4 Features.

You can add commands to the user interface components that appear in the Page Editor when the user selects a markup element, field, rendering, or placeholder.

To add a command for a markup element in the Page Editor, such as an embedded video, you can use an edit frame as described previously in the Client Configuration Cookbook. You can use an edit frame around one or more elements, including any number of fields.

Tip: Avoid edit frames in favor of rendering commands.

To define a new command for a field, rendering, or placeholder, in the Visual Studio project, create a class that inherits from the Sitecore.Shell.Applications.WebEdit.Commands.WebEditCommand class. Create a corresponding entry to the /App_Config/commands.config file. Under the /Sitecore/Content/Applications/WebEdit/Custom Experience Buttons item in the Core database, add a button definition item using the System/WebEdit/WebEdit Button data template.

To add commands for an individual field in the Page Editor, in the Content Editor or the Template Manager, select buttons in the Page Editor Buttons field in the Data section of the field definition item.

To add commands for all fields of a specific type in the Page Editor, in the Content Editor, under the field type definition item in the Core database, in a folder named WebEdit Buttons, insert an item using the System/WebEdit/WebEdit button data template.

To add commands for all fields in the Page Editor, in the Content Editor, under the /Sitecore/Content/Applications/WebEdit/Common Field Buttons item in the core database, add a button definition item using the System/WebEdit/WebEdit Button data template.

To add commands for all renderings in the Page Editor, under the /Sitecore/Content/Applications/WebEdit/Default Rendering Buttons item in the Core database, add one or more button definition item using the System/WebEdit/WebEdit Button data template.

To add commands for an individual rendering in the Page Editor, select buttons in the Page Editor Buttons field in the Editor Options section of the rendering definition item, or in the rendering properties of layout details.

To add commands for all placeholders in the Page Editor, under the /Sitecore/Content/Applications/WebEdit/Default Placeholder Buttons item in the Core database, add button definition items using the System/WebEdit/WebEdit Button data template.

The getChromeData pipeline defined in the web.config file contains processors that determine which commands to expose for each edit frame, field, rendering, and placeholder displayed in the Page Editor.

My prototype for a field command resets a field to its standard value. It seemed almost too easy.

Tags: API, Architecture, Infrastructure

Comments

  • resetting SV on the field directly within PE is awesome.

    - Che Guevara
    October 14, 2010 at 9:13 AM

  • I would love to see 6.4 UI changes in Page Editor.
    If there is not coming 6.4 RC to SDN anytime soon would be nice at least to see some video walk-through showing new changes in UI.

    - Jukka-Pekka Keisala
    October 15, 2010 at 4:01 AM

  • 6.4 available on SDN: http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/Technical%20Preview.aspx

    - John West
    October 18, 2010 at 9:44 AM

  • Great article! This way we might be able to get rid of edit frames.

    - David Stöger
    June 30, 2011 at 1:15 AM

  • In your example you use parameters["field"] = context.Parameters["field"];

    I have tried similar example but with different scope.
    I need the field parameter but it seems it doesn't get populated in context.Parameters. What could it be?

    Also, what would be the way to learn the value of a field from Page Editor. The item in context.Items is the item as in the database, therefore it cannot be used to learn Page Editor user's changes.

    - Andrei Kiss
    August 16, 2011 at 10:25 AM

  • @Andrei: I didn't do anything special to cause Sitecore to pass the field. I wonder if it could be a difference between versions (6.4 introduced a features that replace edit frames).

    I think you might have to force the user to save before they can use your command, or automatically save for them.

    - John West
    August 17, 2011 at 8:36 AM

*
*
*

Learn More with Sitecore

Newsletter
*

Ogden City | Read Case Study >

We have all the complexity we need behind the scenes, yet Sitecore makes this transparent to our users. The site will continue to grow – in a managed and controlled manner.

- Denise Taylor, Ogden City