2

I need to add a new button in the custom experience button. I watched some https://www.youtube.com/watch?v=D6jqqaBMu0s regarding the field editor button. That field editor gives you option to only edits the fields that are in your page (template). Is there a way that i can edit the Datasource item fields.(Renderings)

So if the user goes in Experience Editor click on the rendering(example Standard Dynamic Directory), The ribbon comes up. (Custom experience buttons)

My button should be in the Custom experience buttons and if some one clicks on the button, the Description field under the Editor Options for the rendering should come up in the RTE and the user should be able to edit and save the values. Thanks

enter image description here

enter image description here

3 Answers 3

1

If you are using Glass Mapper 5 and don't want to create Custom Experience Button then you can apply EditFrame using below code:

@using (Html.Glass().BeginEditFrame(Model.HeroBanner, "Edit Banner", m => m.BannerImage,
    m => m.BannerNavigation, m => m.ShowSameMessage, m => m.HideSection))
{
    <div class="background" style="@(Model.HeroBanner.BannerImage != null ? "background-image: url(" + Model.HeroBanner.BannerImage.Src + ")" : "")">
        @if (Model.HeroBanner.BannerNavigation)
        {
            <div class="heading">
                <div class="@(Model.HeroBanner.HeaderStyle != null ? Model.HeroBanner.HeaderStyle.CssClass : "heading-2")">
                    @Html.Glass().Editable(Model.HeroBanner, m => m.BannerTitle)
                </div>
            </div>
        }
        if (!Model.HeroBanner.HideSection)
        {
        <div class="section">
        </div>
        }
    </div>
}

Here Mode.HeroBanner is Model Class and BannerImage, BannerNavigation, ShowSameMesage, and HideSection are the Class properties.

It will allow you to edit all the above properties to edit in EditFrame, you don't need to create any Custom Experience Button.

Here in your case, you can mention Description field in Begin Edit Frame.

0

Datasource item fields can be mapped to Custom Experience Editor Buttons, in the same way as Page item field.

Step 1: Switch to the Core database, navigate to /sitecore/Content/Applications/WebEdit/Custom Experience Buttons items in content editor.

Step 2: Create a new button item, using /sitecore/templates/System/WebEdit/Field Editor Button template.

Step 3: Fill out all four fields, Header, Icon, Fields, Tooltip. Fields is the important one here, as we need to add the field title name. (In your case Description is the field which is of RTE)

Step 4: Switch to master database, and navigate to the component (sub-layout/rendering, in your case Standard Dynamic Directory), and map the newly created button using Experience Editor Buttons field.

Step 5: Now go to experience editor, and edit the component, you should see new Edit button, using which we can edit Description field.

1
  • 1
    HI Gopi, The answer you gave only works for the fields that are on the page(template). The field i want is on the Renderings. If you go to renderings, click on add a new controller rendering then you see the under Editor Option the Description field. I want that value to come up.
    – Mr Sumo
    Sep 17, 2018 at 18:18
0

You should be able to do this with an edit frame

You use the EditFrames feature like this:

@using (Html.EditFrame("/sitecore/content/Home", null, "My custom title", "My custom tooltip", "cssClassName", null)) { <p>Inside of edit frame.</p> } 

The parameters are:

  • DataSource
  • Buttons
  • Title
  • Tooltip
  • CssClass
  • Parameters

You can pass the DataSource parameter in the following formats:

  • /sitecore/content/Home {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}

  • RenderingContext.Current.ContextItem.ID.ToString()

  • RenderingContext.Current.PageContext.Item.ID.ToString()
  • Html.Sitecore().CurrentRendering.DataSource

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.