The kirbytext:after
hook is great to do custom text replacements. I’d love to see such a hook for writer. While it’s not natural to that field because it’s already html and can just be echo’d out, in some cases it could be very helpful.
Example 1: I want to add support for a kirbytag (icon: info)
so that my client can place the info icon whereever they want. Currently I have to create a field method withIcon
and have to call it everywhere:$page->text()->withIcon()
Example 2: I want to replace the string “Lüchtenhof” with a special inline svg version to make the name of the venue stick out. I create a field method addLogo
and have make sure to call it everywhere:$page->text()->addLogo()
Having to call the method on all writer fields is error prone. A hook would give me a nice single place to work with.
You can use page.render:after
hook:
https://getkirby.com/docs/reference/plugins/hooks/page-render-after