3

We're using Sitecore 8.0 Update 3 with Glass.Mapper.Sc 4.1.0.64 and are having an issue in the Experience Editor with Images which are wrapped within a Link.

In our View Rendering, we've got:

@using (Html.Glass().BeginRenderLink(x => x.ImageLink, isEditable: true))
{
    @Html.Glass().RenderImage(x => x.Image, isEditable: true)
}

When both the Link and Image fields are populated, this correctly renders the Image within the Link and the Experience Editor works as expected placing the relevant Link and Image editor buttons on the toolbar when clicking on the Image.

However, when the link is removed by clicking the Clear Link toolbar button, the entire Image is removed from the page meaning the Image field cannot be edited. On saving/reloading the page, the editable Image field is re-rendered correctly.

Is there a way to avoid removing the Image field when clearing the link?

Steve
  • 1,618
  • 3
  • 17
  • 30

1 Answers1

2

You could render your link as non-editable and use an EditFrame for your editors. Glass has good support for Editframes (you can check the tutorials or some blogs) and it's an easy setup. You can even choose to add the image to the EditFrame as well.

It's more a workaround than a solution though.

Gatogordo
  • 2,629
  • 2
  • 22
  • 32
  • Thanks for answering. The current editing experience apart from clearing the link works really well - intuitively places the link field buttons in the toolbar for fields inside of the link. We've looked into alternative approaches such as separating the link field from the image field when in edit mode, and as you suggested using an EditFrame as a means of editing both fields. I'm going to look into whether this might be a bug in either Sitecore (possibly fixed in a later version) or Glass.Mapper. – Steve Jun 08 '16 at 08:14