As documented here, I've created a custom filefield source that gets images from Apache Solr, and I'm using this in conjunction with the Insert module. I wanted to add some additional markup for displaying a caption when the image is inserted into the body, so I did the following steps:
- Created a custom version of the Seven admin them (called cns_seven),
- Implemented hook_insert_widgets_alter() to modify the wrapper and add the widget for the caption field, and
- Overrode the image-insert-image.tpl.php in my cns_seven theme.
If I use the default Upload option or one of the default Filefield Sources (such as Autocomplete Reference) for the image, the custom template is used just fine when inserting the image into the body. However, when I use my custom source field, it isn't used. I did some debugging, and discovered that the theme() function for some reason is looking for image-insert-image.tpl.php in my front end theme and not cns_seven, even though I'm using cns_seven when editing the node (so adding a version of that template in the front end theme achieves the functionality). I've looked through the code in both modules, I don't see anything that adds a custom template suggestion or does anything extra to force the function to look in the admin theme.
Any idea as to what would be causing this?