EditFrame vs Experience Editor Buttons in Sitecore

EditFrame and Experience editor buttons are both great ways of adding experience editor support to our Sitecore pages.

  • EditFrame buttons
    • Create item in core database (I usually just duplicate the Default folder at /sitecore/content/Applications/WebEdit/Edit Frame Buttons/Default). You can add the field(s) you want to make editable in the ‘Fields’ field
    • In your view, you need to wrap the html that you want to make editable, with the EditFrame code, where you need to supply it with the path of your edit frame button in core, and the item ID of the item you want to edit. The fields made editable would depend on the fields you include in the EditFrame button item as shown in the above image.
      @using (BeginEditFrame("/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Headline", Model.Id.ToString()))

    You will now be able to see additional buttons around the html you enclosed in the EditFrame code

  • Experience Editor Buttons
    • Create button item in Core database – use the template – /sitecore/templates/System/WebEdit/Field Editor Button and create the /sitecore/content/Applications/WebEdit/Custom Experience Buttons
    • In your rendering, select the button you just created in the ‘Experience Editor Buttons’ field

    The additional button you created will now be available when you select the entire rendering. If the datasource is available, that item is considered for editing and the field name mentioned in the experience editor button item in core is searched for in that item, else the context item is considered for the same.

Points to note about these 2 implementations:

EditFrame Buttons Experience Editor Buttons
Providing fields to edit Pipe separated – In the core item for the button Pipe separated – In the core item for the button
Item to be edited Item id passed in, in the view code The datasource item is used if available, else the context item is used. This is irrespective of whether the fields mentioned in the button item exist in the datasource item.
Code change required Yes, code needs to be added in the view as shown above. No
Html to be selected  Only the html around which the EditFrame code is wrapped needs to be selected to see the button. The available buttons show up when the entire rendering is selected.
Flexibility  You can choose to edit any number of items selecting any single html tag as is the requirement. Only 1 item can be edited per rendering (datasource or context item), and individual html elements cannot be selected to see the button(s).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s