Closed (fixed)
Project:
ImageField Tokens
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
7 Feb 2011 at 08:42 UTC
Updated:
4 Dec 2012 at 01:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Shadlington commentedSubbing
Comment #2
mattab commentedIs it possible to use tokens in Images alt="" in Drupal 7 currently?
Comment #3
lpalgarvio commented+1
Comment #4
richardbporter commentedsubscribe
Comment #5
jeffwidman commentedsubscribe
Comment #6
jdufaur commentedsubscribe
Comment #7
anthonyR commentedsubscribe
Comment #8
narongwit12 commentedsubscribing
Comment #9
Gekiboy commentedsubscribing
Comment #10
sachbearbeiter commented+1
Comment #11
logii commented+1
Comment #12
sachbearbeiter commentedchanged title for better tracking
Comment #13
dgastudio commentedsub
Comment #14
fuse commented+1
Comment #15
Jerome F commentedsubscribing
Comment #16
sonar_un commentedSubscribe
Comment #17
james.williamsHere's a first, fairly rough & quick, but working, port to D7.
It doesn't show possible replacement patterns yet, and doesn't show anything on the field/instance settings forms (which don't currently show form elements for the alt & title text anyway). Since Image FUpload doesn't have a version for Drupal 7, I haven't allowed it to work with ImageField tokens.
All of the above things could potentially change in a future patch, but this patch implements the basic functionality so it works. Note though that while tokens like
[title]worked in D6, now they must be updated to to[node:title](i.e. all tokens now follow the[type:token]format). Also, I would like to change the timing of the token replacements from on node/field saving, to when they should be displayed (since the tokens values could change between those times), but for now I'm just sticking with how it was previously implemented.Comment #18
anthonyR commentedGreat work! Will try to test it in the coming days.
Comment #19
james.williamsThis patch improves on the one in #17. Any entities are now supported, not just nodes, file and user (the node author) tokens are now made available, and the token replacement happens when the field is attached for display, rather than on saving the node (entity) so they can be more dynamic.
I also use a hook (
hook_imagefield_tokens_supported()) to detect supported fields, rather than the old_imagefield_tokens_support_list(), so other potentially compatible modules can be used with the module. Note that this now lists supported field types not field widgets, since token replacement is done just before display, rather than on saving. (The chances are that the 'image' field is the only type that will ever be supported - of the two contrib modules that were previously supported Imagefield Crop uses this, and I assume ImageFUpload will too. These modules supply field widgets rather than new field types.)This is a fairly major (but simple) change to how the module worked in D6 (even if the end result is the same) - which I would advocate as being better, since fields and tokens themselves have changed substantially too.
Comment #20
james.williamsAlso note - ImageField Tokens in D6 showed the possible replacements on the field settings form alongside the default alt/title fields. In D7, there are no default alt/title fields, so I won't go as far as adding these in D7 as that's another issue. And since this was the only place that the module showed these in D6, I won't be adding them to the entity forms in D7. This would again be very useful, but I don't want to go too far beyond this issue's remit of porting the D6 version for D7. Such (very useful and obvious) changes make sense to go in a future version, but in another issue.
Comment #21
sachbearbeiter commentedsubscribe
Comment #22
bensnyder commentedsub
Comment #23
Anonymous (not verified) commentedSubscribe
Comment #24
W.M. commented@james.williams
Thanks for the interest and work put into this issue. If I understand well it is not possible currently to set a default value for the alt field (e.g. [node:title]). We need to re-enter this value for each image file ?! Correct me if I am wrong.
In that case you are saying that the default value option requires patching other files (not related to ImageField tokens module)
I will happily test the patch and provide feedback. Thanks mate :)
Comment #25
Jackinloadup commentedsubscribe
Comment #26
Quarantine commentedSubscribing.
Comment #27
zuzu83 commentedsubscribe
Comment #28
theroyal commentedsubscribing
Comment #29
Andrew Gorokhovets commented+1
Comment #30
Andrew Gorokhovets commented# 19 does not work in my case
Comment #31
james.williamsDo you mean the patch doesn't apply any more, or it breaks something? Could you give us some more detail please...
Comment #32
basicmagic.net commentedsubscribe
Comment #33
13rac1 commentedAh ha! I knew this functionality had to exist in D6, but I just found it now.
My sandbox contains a D7 version of this module with the added benefit of default values for the alt and title fields: http://drupal.org/sandbox/eosrei/1315294
I've sent a note to Deciphered regarding becoming a maintainer for this project. If he agrees, I'll change file/function names and then there will be a D7 version.
Comment #34
jordanmagnuson commentedJust tried eosrei's sandbox D7 version, and it seems to be working well for me so far... it would be great if we could get an official 7.x dev version of this.
@eosrei: thanks for the D7 work! One question: do you think it would be possible to implement an option to retroactively update existing nodes? See http://drupal.org/node/428754
Comment #35
Andrew Gorokhovets commentedTo #31.The module now works. Doesn't work only that you discribed in #20. Thank you.
Comment #36
jordanmagnuson commented#33:
The "Alt Field Settings" and "Title Field Settings" are showing up on all fields, not just image fields.
When I go to edit any field besides my image field, I get error messages:
Comment #37
13rac1 commentedHaha. Well that is another reason it is only in my sandbox, and I haven't promoted it to a full project: I haven't thoroughly tested it yet. I'll correct those notices this afternoon.
Comment #38
13rac1 commentedFYI Issue in #36 has been corrected.
Comment #39
jordanmagnuson commentedConfirmed #33 now working without errors. Thanks eosrei!
Comment #40
anthonyR commentedI'm using eosrei's sandbox project and can confirm it's working. It would be great to see this evolve in the D7 dev version of this module.
Comment #41
Anonymous (not verified) commentedWorks great! Time to publish an alpha or dev version.
Comment #42
13rac1 commentedI haven't heard back from Deciphered about being added as a maintainer, so there is nothing I can do about making this an alpha or dev version.
If this works for you, please set this issue to RTBC as I "cannot" do it.
Comment #43
Anonymous (not verified) commentedChanged status to RTBC.
Comment #44
decipheredHi all,
Well overdue, but an update no less. FileField Paths (the major dependency of ImageField Tokens) has just had a D7 Beta release, which means that ImageField Tokens can soon get the required attention.
Based on an earlier discussion with eosrei, his sandbox version doesn't actually support Node/Entity tokens such as the Node id or anything else that is not yet know during the creation of the content, which is the core purpose of this module, however I'm definitely happy to have an active and interested developer working on this solution and intend to work together to get a stable ImageField Tokens release as soon as possible.
Please bare with me a little bit longer.
Cheers,
Deciphered.
Comment #45
13rac1 commentedHey Deciphered, I won't be on IRC until tomorrow.
I emailed you a few weeks ago that with slight modification my sandbox code will support Node ID and the related tokens without requiring FileField Paths as a dependency. If that is the only thing stopping this process, then I'll gladly implement it. As far as I can tell, the hook_filefield_paths_process_file() hook can be replaced with the D7 core functions hook_field_storage_pre_insert() and hook_field_storage_pre_update(). The functions run after drupal_write_record('node', $node); and drupal_write_record('node', $node, 'nid'); but before the field data is saved. Therefore, they have all the data, but won't require an additional expensive call to field_attach_update(). Neither file.field.inc or image.field.inc implement hook_field_storage_pre_insert/update(), so there isn't worry of data modification. Does FileField Paths provide anything to ImageField Tokens beyond the hook_filefield_paths_process_file() hook? (It doesn't look like it to me)
Function reference: http://api.drupal.org/api/drupal/modules--field--field.attach.inc/functi...
Comment #46
decipheredeosrei,
The benefit for me using FileField Paths was that it allowed me to share an engine across multiple modules, but given that ImageField Tokens never fully took advantage of the FileField Paths engine (doesn't seem that I ever implemented Retroactive Updates, etc) then I'm not to upset if it where to split.
If I were to hand the reins over to you, which I'm more than happy to do, it would be under the understanding that you would maintain the module, something which I have not been able to do. If you were to take the set and forget approach that I have obviously taken then I don't see the benefit for users, as in another few years time it would be again needing a major update but I would have no relation to the code base at all.
I'm more than happy to do a FileField Paths based port to D7 allowing the module to leverage that engine and in turn get access to Retroactive updates and/or any other relevant functionality.
I guess it's up to the users and/or yourself in how to best proceed.
Comment #47
Anonymous (not verified) commented-
Comment #48
klonos...any update on the progress of this one?
Comment #49
terry22 commentedno news about D7 version?
Comment #50
Dimm commented# 19 does not work in my case
Comment #51
klonos...only assign issues to yourself if you intent to work on them.
Comment #52
Louis Bob commentednews ?
Comment #53
decipheredNo news, never heard any more from eosrei, so I have to assume that he's no longer interested in taking over the project which looks like it falls back to me when I have the time.
I will try to make the time, but as it's not a module that I currently need to use I can't confirm when that time will be made.
Patches are more than welcome though.
Comment #54
Louis Bob commentedOk thanks a lot for the info :)
Comment #55
voodootea commentedHi .. your sandbox git version is empty and the readme just says 'It is all in the 7.x-1.x branch!'...
where do i get this as the main module page doesn't list anything for v.7.x
many thanks
Comment #56
pomliane commentedComment #57
steven jones commentedSo there is code in the 7.x-1.x branch of the sandbox here: http://drupal.org/sandbox/eosrei/1315294 but in reality, it's a different module, as per #33.
So I reckon that we have a some code, but it needs review, updating the status accordingly.
Comment #58
danny englanderSince the sandbox project is now empty of code (I did a
Git clonebut all I got was a readme file) and as per the readme in there:... would anyone be able to PM me with a zip file with any actual code there in the past, perhaps someone has the code downloaded? I'd like at least a short term solution until this perhaps gets sorted out sometime in the future. My use case is I am building a new photo site for myself and using the EXIF Module. I'd like ALT and TITLE tags to take on an EXIF caption token that I have already created.
Thanks, Danny :)
Comment #59
steven jones commented@highrockmedia If follow the instructions on the sandbox page, and clone the git repo like so:
Then you will see the code in the 7.x-1.x branch, as per #57.
Comment #60
danny englander@Steven Jones - thanks, got it now, that worked but just curious where you saw those instructions? Thanks.
Comment #61
steven jones commented@highrockmedia So you either do what the readme in the master branch told you, and run
Or follow the instructions on the version control page:
http://drupal.org/project/1315294/git-instructions
Comment #62
LTech commentedI would like to add a alt field using tokens for a default image, using drupal 7.
How do I install the module? I've tried following the link in #59 but it seems to be broken.
Any instructions on how to get the code would be appreciated. Thanks
Comment #63
jonthomas83 commented+1 and subscribing!
Comment #64
o-ar commentedSubscribe
Comment #65
skizzo commentedStop subscribing, start following
Comment #66
Anonymous (not verified) commentedHere's a patch for ImageField Tokens that uses the code from eosrei's sandbox module. Note that I made some changes, specifically adding '#states' to certain form elements to make them hidden/disabled when the alt and title fields were turned off.
Let's review and try to get a D7 branch going!
Comment #67
ethnovode commentedHello,
Thanks for this patch it is working for me. I just needed to manually edit the .info file to delete the 6.x infos.
Comment #68
plazik commentedThanks BWPanda!
The patch works fine. It's time to make a 7.x-dev version!
Comment #69
13rac1 commentedJust over a year since I posted the sandbox. Time flies on d.o. I was gone for a while, but now I am back. Still interested to maintain and I even have time now.
Deciphered, if you add me, I'll create a 7.x-1.x branch using my sandbox rewrite, apply BWPanda's changes, then fix all the issues currently in the sandbox queue. I'd really like this module to have a D7 release. Thanks!
Comment #70
mhotby commentedI'm using xampp and I had to change MySQL max_allowed_packet_size to get this working.
Solution found from here http://drupal.org/node/984112#comment-4025560
Comment #71
deciphered@eosrei,
Done, good luck.
Comment #72
13rac1 commentedAwesome! Thanks.
Comment #73
13rac1 commentedI added a 7.x-1.x branch containing a direct conversion of my sandbox code. I'll apply BWPanda's changes and other fixes next week.
Comment #74
13rac1 commented