0

I'm using Sitecore MVC with Glass Mapper.

When I'm creating a component with a link field, I just add @Editable(myLink, x=> x.myLinkField)

After setting the links properly on Experience Editor and publishing, it automatically creates the anchor tag with the specified url, class, etc.

I'm wondering where exactly application is creating those attributes and tag. Is this the work of Glass Mapper or any other code?

  • Glass mapper uses Sitecore RenderField functionality in the background. – Marek Musielak Feb 14 '18 at 17:55
0

Internally glass is using sitecore APIs only. If you want to have a look at the exact code then check the GlassView class under Glass.Mapper.Sc.Web.Mvc namespace,using any decompiler, in that you will find all the editable methods which internally make a call to Editable method of GlassHtml class under Glass.Mapper.Sc namespace.

You can find the final code in BeginRenderLink method of GlassHtml class only. The BeginRenderLink is creating anchor tag for you when you use the Editable method for link field.

| improve this answer | |
  • As I've looked into the code, this is part of what I'm looking for! thanks for this! Though I'm not using BeginRenderLink, or RenderLink methods I saw, I'm just using the @Editable(myLink, x=> x.myLinkField). How does that create the anchor tag? – qwert Feb 15 '18 at 9:45
  • Yes, as I said, at the end it is calling BeginRenderLink only. All editable methods are making call to "MakeEditable" method of GlassHtml class. The "MakeEditable" method checks the field type and if it is link then it will make call to "BeginRenderLink". – NSP Feb 15 '18 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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