4

I need to import HTML formatted content to a custom event field for a larger number of events.

During import via the API, HTML tags are being escaped and rewritten: <a href=“https://example.com“>Linktext</a> becomes &lt;a href=“https://example.com“&gt;Linktext&lt;/a&gt;.

Is there a way to avoid this and preserve the tags as they are?

1 Answer 1

5

You can edit /CRM/Utils/API/HTMLInputCoder.php: CRM_Utils_API_HTMLInputCoder->getSkipFields returns a list of fields that will be skipped on encoding. Add an entry for your custom-field to this list prevents the html-input from being escaped. The entry must be "custom_" + custom-field-id.

1
  • Is there a clean way to do the same?
    – Bastien Ho
    Sep 27, 2019 at 14:36

Your Answer

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

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