Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The image field named: field_events_foto. Default insert style: Original image.
I copy to my themes the files insert-image.tpl.php - module(insert) sees it.
I rename ant try to use insert-image--field-events-foto.tpl.php, image-insert-image--field-events-foto.tpl.php - module does not see all them :(.
The cache is cleared each time. Where's the problem?
Comment | File | Size | Author |
---|---|---|---|
#8 | insert-1803096-per_field_template_suggestions.patch | 2.46 KB | Snater |
Comments
Comment #1
quicksketchInsert module does not provide per-field template suggestions (though that's a good feature request, which is where I've moved this). It only provides per image-style suggestions. So you can have templates like
image-insert-image--thumbnail.tpl.php
orimage-insert-image--large.tpl.php
.For the
insert-image.tpl.php
we don't provide any suggestions at all. I think making those by field name sounds like a good idea. Are you using an image preset with your example or just trying to insert the original image?Comment #2
jack-pl CreditAttribution: jack-pl commentedI copied
image-insert-image.tpl.php
file from module templates directory and paste to mytheme/templates, but it's not working.I've tried also:
these files aren't working either.. The cache is cleared. Tested on clean installation of Drupal 7.22
Comment #3
jordi_bcktt CreditAttribution: jordi_bcktt commentedI have exactly the same problem
Comment #4
boshtian CreditAttribution: boshtian commentedSame problem here.
Image style name is
content_image
, my template name isimage-insert-image--content-image.tpl
but it's not working.Comment #5
boshtian CreditAttribution: boshtian commentedAs soon as I published comment, I realized what I'm doing wrong.
If you're using admin theme, the template files must be in there, because you use that template when editing content.
Comment #6
mesch CreditAttribution: mesch commented+1 for this feature. Perhaps it would be sufficient to add in helpful variables to the template preprocessors that would allow everyone to create their own theme hook suggestions. I can see the following as being especially useful:
- field name
- entity type
- entity bundle
Comment #7
mesch CreditAttribution: mesch commentedIn case it's of use to anyone else out there, here is how I applied markdown templates I created to one content type only. It's obviously a bit of a hack, but a functional hack nonetheless.
Comment #8
Snater CreditAttribution: Snater commentedBrowsing though old tickets while working on the module's D8 version. This ticket is quite reasonable. I have attached a change set that should implement template suggestions by field name. I briefly tested it. It is a bit hacky, because
hook_insert_element
is simply extended with$element
. I do not see a major reason, why not to pass$element
(it would, of course, also be possible to just pass$element['#field_name']
), but the function signature could be a bit cleaner. However, shuffling parameters would require a new major version of Insert for Drupal 7 (7.x-2.0), which I do not see happening any more.I will implement additional template suggestions in the D8 version as well.
Comment #10
Snater CreditAttribution: Snater commentedComment #12
Snater CreditAttribution: Snater commentedComment #14
joelpittet@Snator
I ran into a fatal error due to this change, not totally sure if I should post here or fix
multiupload_filefield_widget
so I'll do both. #3403905: ArgumentCountError: Too few arguments to function image_insert_content(), 3 passed in multiupload_imagefield_widget/multiupload_imagefield_widget.moduleComment #15
joelpittetDon't get me wrong, I appreciate the new life you've given to this module, keep up the good work!