I'd like to modify insert-link.tpl.php but it seems it is never picking it up from my theme templates directory. Note it's a zen subtheme.

Comments

tahiticlic’s picture

Same behavior here. I'm using a custom theme, no Zen interaction.

quicksketch’s picture

Category: feature » support

It's probably because you're using an admin-theme for creating content. You may need to subtheme your admin theme (Seven, most likely) and place the template in your subthemed admin theme.

tahiticlic’s picture

Same behavior even when inserting custom templates in the admin theme.

tahiticlic’s picture

Also tried without an admin theme, same bahavior : no way to override default template files.

tahiticlic’s picture

Latest test : replacing insert module templates directly in the module, no effect...

quicksketch’s picture

Latest test : replacing insert module templates directly in the module, no effect...

Maybe you're editing the wrong template file? Clearly the markup has to come from *somewhere*, and the template files are where the markup originates. Note that there are two template files for images: "image-insert-image.tpl.php", which is used for inserting images that have an image style (like thumbnail, medium, larget, etc) and "insert-image.tpl.php", which is used when inserting a full-size image.

tahiticlic’s picture

You right, I guess I'm not editing the good file. I'll check that.

kliker’s picture

Basically in order to override module's templates you need to upload them to your admin theme folder.

Module's README.txt is saying to your active theme's directory and I believe it would be easier to understand by saying to your admin theme directory.

Theming
-------

Insert can be configured to work with non-HTML filters like BBCode or Markdown.
To do this, copy the template file you would like to change from the "templates"
directory to your active theme's directory.

quicksketch’s picture

Title: Template file » Document template file theme (admin vs. front-end)
Component: Code » Documentation
Category: support » task

Thanks @kliker, good suggestion. I'm moving this to a task.

cac2s’s picture

Hello guys.
First of all I apologize for my English and I hope you will understand me right...

I ran into the same problem.

I need to wrap img tag with div tag like this:

<div class="photo">
	<img src="<?php print $url ?>" <?php if ($width && $height): ?>width="<?php print $width; ?>" height="<?php print $height; ?>" <?php endif; ?>alt="__alt__" title="__title__" class="image-<?php print $style_name ?><?php print $class ? ' ' . $class : '' ?>" />
<div>

I have copied the image-insert-image.tpl.php file in the folder with the active theme (editing node is not in the admin theme, but in the active theme), then I have edited template with code above, cleared the cache, but when I insert a thumbnail picture there is no changes:

<a href="http://example.com/sites/default/files/styles/large/public/page/4504966240_cca01547e8_o_1.jpg?itok=CPf9d6Fb"  class="colorbox colorbox-insert-image" rel="gallery-all">
	<img typeof="foaf:Image" src="http://example.com/sites/default/files/styles/page_thumbnail/public/page/4504966240_cca01547e8_o_1.jpg?itok=sP0ubM6L" alt=""  class="image-page-thumbnail" />
</a>

P.S.: I have tried do same chanes with insert-image.tpl.php — no result.
P.S.S.: сopying the template file to the folder with admin theme (ROOT_FOLDER/themes/seven/) also gave no results.

UPD: customizing template colorbox-insert-image.tpl.php solve my problem.

  • Snater committed b017865 on 7.x-1.x
    Issue #1819872: Updated Readme on theming
    
Snater’s picture

Issue summary: View changes
Status: Active » Fixed

Browsing through old tickets while working on the module's D8 version. I altered the Readme file as suggested. The place where to put template overwrites is a regular source of confusion, so, for some emphasis, I put ADMIN in capital letters.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.