We have implemented a ECL with a custom image provider and it works well in most of the cases. We also have a requirement to use the ECL in RTF along with attributes like style, height, width etc.

We have implemented GetTemplateFragment so that it can take those attributes and pass them on to ECL to get the correct sized image.

The problem is that the "attributes" that the method "GetTemplateFragment" is getting is empty and does not contain the attributes that we have added in RTF.

We tried to look around and noticed that "emptyAttributes" are being passed to "GetTemplateFragment" here

Is our understanding correct? or are we missing something? Do we need to include something else so that the attributes are passed to the method?


Your analysis is correct; the EclModelBuilder currently does not pass HTML attributes to the GetTemplateFragment method of the ECL Provider.


You would have to customize DataModelBuilder.BuildRichTextModel. See https://github.com/sdl/dxa-content-management/blob/release/2.0/Sdl.Web.Tridion.Templates.R2/Data/DataModelBuilder.cs

Please report this limitation as an issue on GitHub.

  • Thanks for your response, Rick. Does that mean that we cant pass the additional parameters to ECL Provider? Is there any other way? Because, in that case, we wont be able to meet client requirements when they are using RTF. – GJin Jan 11 at 1:52
  • Updated the answer. – Rick Pannekoek Jan 11 at 15:47
  • We have updated the code on our end as per your guidance and deployed it. It is working as expected now. – GJin Jan 14 at 20:16
  • Good to hear! If you submit your code changes as a Pull Request on GitHub, others can also benefit from it and it increases te chance that this gets included in the upcoming DXA 2.2 release. – Rick Pannekoek Jan 16 at 6:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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