Question: How do I edit the default template for images in the htmleditor
I’m currently trying to add a css class to all images in all HTMLEditorFields on the site. My other theme files such as Page.ss are loading properly. I tried overriding mytheme/templates/SilverStripe/Assets/Shortcodes/ImageShortcodeProvider_Image.ss, mytheme/templates/DBFile_image.ss and mytheme/templates/DBFile_image.ss but nothing worked. I also tried building and flushing all templates but that did not help.
You say “in all HTMLEditorFields” - do you mean when it is inside the WYSIWYG in the CMS specifically, or do you mean on the front-end?
The SilverStripe/Assets/Shortcodes/ImageShortcodeProvider_Image.ss template will be the correct template for these in CMS 5.3, but in 5.2 it doesn’t exist yet.
Your comment really helped me, thanks. Can you point me in the right direction for overriding the shortcode? I’d guess I’d do that with dependency injection but I never really did something that deep in the cms
Oh, I didn’t think you can override existing shortcodes. I’ll create a pull request for that part of the documentation to clarify that. Thanks for your help