Right, so I’m feeling royally and utterly stupid, but I can’t find where the img tag inside the figure tag comes from, when the content comes from content files (as opposed to being hardcoded into templates), as I would like to modify how it gets written out.
I am using a script for responsive images (http://responsiveimg.com/), which is working wonderfully for all my images that are coded into the templates, or that I can predict will be within the content. However, when I hand it all over to the user/client I would like to have a solution in place that is as idiot proof as possible, and I am pretty sure they will do things I can’t predict today, and therefore I would like to be change the img tag and how it gets written out (and not the surrounding figure tag, which I can reach easily).
I have looked, I have searched in all files, and I just can’t find it, probably due to me being stupid, but at the moment my best stab at an explanation to how it ends up in the code is via divine intervention, though I’m guessing that is not correct.
Help would be appreciated. I’ll wear the silly hat afterwards. Thanks.
If you want to modify the way the kirbytext image tag is built, the best way to do that is via a custom kirby tag: http://getkirby.com/docs/advanced/kirbytext. You can just copy the image tag and then modify the parts you want to change.
Other than that, kirbytags (and the way figure tags are built) are defined in kirby/extensions/tags.php, but then it wouldn’t be a good idea to change the core.
Ah, excellent, I was actually just now reading about custom tags, and was hoping that I could write a custom tag that overrides a built-in tag. It looks like the perfect solution indeed, thanks. As you say I would like to not change core as I keep it nicely update-able via Git at the moment.
The tags are defined in /kirby/extensions/tags.php. If you want to build your own custom tag, copy the image tag from that file and save it into /site/tags, then make your changes as desired. You can either overwrite the original tag by giving your new tag the same name, or give it another name.
I want to use a custom Kirbytag to add automatically a class to all image tags within Kirbytext. The problem is, I want to preserve the standard abilities of the image tag and I haven’t enough php or programming knowledge to do it.