0

So i was trying to add title tag for all my images in Sitecore. John West had a solution here

The issue is, I am not getting all the rendering fields in my pipeline. When i debug the Solution, the breakpoints hits only 4 or 5 times totally and they are all different fields either under footer. Interestingly all of them are only "Rich text" Fields. What am i missing? Why am i not getting all the fields under Sitecore.Pipelines.Renderfield.RenderFieldArgs?

I am also using Glassmapper and using @RenderImage to render the images. Couldthat be the reason?

Night Monger
  • 770
  • 1
  • 10
  • 33

1 Answers1

0

GlasMapper does not run through the RenderField pipeline in Normal mode (it does in edit mode), this issue has been raised before as an issue on Github for String field types.

You can either force it through the pipeline by creating a custom html helper extension which works in much the same way as Glass does in Edit mode.

Or alternatively I'd suggest creating a custom Glass Mapper Data Handler inheriting from SitecoreFieldImageMapper and then overriding the MapToImage methods. Use that as the type for your property or replacing out/insert before the existing mapper registrations in DataMapperConfigFactory.

jammykam
  • 16,940
  • 2
  • 36
  • 71
  • Thanks @jammykam.. I kind of guessed it. I actually wanted to add only the title attribute.. I chose the easier option to directly change img tags instead of using renderimage option. But it kind of surprises me why title attribute is not getting rendered even though there is a value there. i have raised it as a seperate question tho.. – Night Monger Aug 04 '16 at 15:39
  • 1
    According to the github issue, this has been resolved since release 4.0.3.50. You can now add a field setting `SitecoreFieldSettings.ForceRenderField` which forces a string field to use the `renderField` pipeline. – Ben Sewards Oct 16 '18 at 14:48