Embed code in Writer field

Hi,

I have a client who has a Writer field into which they want to paste an embed code - it’s a booking thing, looks like this:

<a href="https://www.ticketsource.co.uk/booking/t-dvqdeok">
  <img border="0" width="130" height="56" alt="Book now"
     src="https://www.ticketsource.co.uk/images/bookNow/bookNow-black-small.png">
</a>

When they are adding this it is outputting the code to the front end, rather than the embed. This is what I would expect to happen with this field, but is there a custom mark / node I could implement that would allow this sort of thing?

If anyone has hit this issue before / has a solution that would be super. I know I could use blocks in this instance but that will add complexity which I am trying to avoid if possible

The writer field escapes all HTML to protect against cross-site scripting (XSS) vulnerabilities in the content.

To embed custom HTML in a writer field, you have two options:

  • You can implement a custom node. I’m not aware of preexisting plugins for TicketSource in particular.
  • A simpler alternative could be to implement a KirbyTag. Your client can then include a line like (ticketsource: t-dvqdeok) in the writer field content. With $page->yourField->kirbytags() you can then parse this KirbyTag and convert it to the intended HTML output.