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.
I'm using the File Entity module to add extra fields to images, such as caption. File Entity alt tags also aren't working with insert. I was wondering, how can I go about making these modules work together, will I have to use a custom image-insert.tpl.php, or is it something to do with allowing insert to read extra values in the file widget?
Thanks in advance.
Comments
Comment #1
stevieegee CreditAttribution: stevieegee commentedDid you manage to get the modules playing together? I am in the same boat.
Comment #1.0
stevieegee CreditAttribution: stevieegee commentedGrammar
Comment #2
sachbearbeiter CreditAttribution: sachbearbeiter commentedsame question: Did you manage to get the modules playing together? I am in the same boat.
Comment #3
sachbearbeiter CreditAttribution: sachbearbeiter commentedi only did a short attempt:
image-insert-image.tpl.php
additional:
initial from insert:
additional:
works, but you have to fill the fields and save the node and reload ...
as quicksketch writes:
@quicksketch it would be really nice if you can write two lines, how you deliver for example the __alt__ and __title__ values via js to the texfield ...
br sb
Comment #4
sachbearbeiter CreditAttribution: sachbearbeiter commentedcollecting:
https://drupal.org/node/1344290
Comment #5
lukusHi
I managed to get these playing together by exposing values stored in the $item array.
e.g. for caption (which I'm providing via description) ..
print $item['description']
Hope this helps
L
Comment #6
Snater CreditAttribution: Snater commentedBrowsing through old tickets while working on the module's D8 version. I had a look at that issue and I do not see that happening. This would require adding a whole new dimension to the Insert module. Insert compiles the HTML to insert from pregenerated templates that are filled with particular content extracted from the form's fields using JavaScript. As far as I can see without being a regular File Entity user, there is no way, at least not without using another module, to retrieve an entity's fields per JavaScript directly in the form. Probably, retrieving those fields would at least require implementing some complex AJAX functionality. The quote of comment #4 is absolutely correct, but that applies to generating the form--at that moment is is not known which file entities are selected. You could only provide information on entities that are already stored in the form.
__alt__
and__title__
fields are simply retrieved by accessing the corresponding form fields using JavaScript.I do not see a way to easily combine Insert and File Entity. When selecting a file entity, its fields would need to instantly be accessible. Apart from that, Insert would need to support random or custom replacement variables, which would require a fundamental architectural change of Insert. It might even be easier to implement Insert functionality directly into a module depending on File Entity, instead of interfacing to the Insert module.
I tend towards closing this ticket as won't fix, as it would result in a massively complex design contradicting with the intention of Insert. It is just out of scope. That said, I will leave this ticket open for a few more weeks, as I might be wrong on some assumptions.
Comment #7
Snater CreditAttribution: Snater commentedAs per last comment.