Any plans for a D7 version of this wonderful module? Would you like patches?

Comments

Shadlington’s picture

Subbing

mattab’s picture

Is it possible to use tokens in Images alt="" in Drupal 7 currently?

lpalgarvio’s picture

+1

richardbporter’s picture

subscribe

jeffwidman’s picture

subscribe

jdufaur’s picture

subscribe

anthonyR’s picture

subscribe

narongwit12’s picture

subscribing

Gekiboy’s picture

subscribing

sachbearbeiter’s picture

+1

logii’s picture

+1

sachbearbeiter’s picture

Title: D7 version » ImageField tokens D7 version

changed title for better tracking

dgastudio’s picture

sub

fuse’s picture

+1

Jerome F’s picture

subscribing

sonar_un’s picture

Subscribe

james.williams’s picture

Here'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.

anthonyR’s picture

Great work! Will try to test it in the coming days.

james.williams’s picture

This 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.

james.williams’s picture

Also 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.

sachbearbeiter’s picture

subscribe

bensnyder’s picture

sub

Anonymous’s picture

Subscribe

W.M.’s picture

@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 :)

Jackinloadup’s picture

subscribe

Quarantine’s picture

Subscribing.

zuzu83’s picture

subscribe

theroyal’s picture

subscribing

Andrew Gorokhovets’s picture

+1

Andrew Gorokhovets’s picture

# 19 does not work in my case

james.williams’s picture

Do you mean the patch doesn't apply any more, or it breaks something? Could you give us some more detail please...

basicmagic.net’s picture

subscribe

13rac1’s picture

Ah 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.

jordanmagnuson’s picture

Status: Active » Needs review

Just 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

Andrew Gorokhovets’s picture

To #31.The module now works. Doesn't work only that you discribed in #20. Thank you.

jordanmagnuson’s picture

Status: Needs review » Needs work

#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:

  • Notice: Undefined index: alt_field_sync_title in image_attribute_defaults_form_field_ui_field_edit_form_alter() (line 44 of /srv/www/pixelscrapper/public_html/sites/all/modules/contrib/image_attribute_defaults/image_attribute_defaults.module).
  • Notice: Undefined index: alt_field_update_on_edit in image_attribute_defaults_form_field_ui_field_edit_form_alter() (line 50 of /srv/www/pixelscrapper/public_html/sites/all/modules/contrib/image_attribute_defaults/image_attribute_defaults.module).
  • Notice: Undefined index: alt_field_default in image_attribute_defaults_form_field_ui_field_edit_form_alter() (line 56 of /srv/www/pixelscrapper/public_html/sites/all/modules/contrib/image_attribute_defaults/image_attribute_defaults.module).
  • Notice: Undefined index: title_field_update_on_edit in image_attribute_defaults_form_field_ui_field_edit_form_alter() (line 79 of /srv/www/pixelscrapper/public_html/sites/all/modules/contrib/image_attribute_defaults/image_attribute_defaults.module).
  • Notice: Undefined index: title_field_default in image_attribute_defaults_form_field_ui_field_edit_form_alter() (line 85 of /srv/www/pixelscrapper/public_html/sites/all/modules/contrib/image_attribute_defaults/image_attribute_defaults.module).
13rac1’s picture

Haha. 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.

13rac1’s picture

Status: Needs work » Needs review

FYI Issue in #36 has been corrected.

jordanmagnuson’s picture

Confirmed #33 now working without errors. Thanks eosrei!

anthonyR’s picture

I'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.

Anonymous’s picture

Works great! Time to publish an alpha or dev version.

13rac1’s picture

I 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.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Changed status to RTBC.

deciphered’s picture

Hi 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.

13rac1’s picture

Hey 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...

deciphered’s picture

eosrei,

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.

Anonymous’s picture

-

klonos’s picture

...any update on the progress of this one?

terry22’s picture

no news about D7 version?

Dimm’s picture

Assigned: Unassigned » Dimm

# 19 does not work in my case

klonos’s picture

Assigned: Dimm » Unassigned

...only assign issues to yourself if you intent to work on them.

Louis Bob’s picture

news ?

deciphered’s picture

No 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.

Louis Bob’s picture

Ok thanks a lot for the info :)

voodootea’s picture

Hi .. 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

pomliane’s picture

Status: Reviewed & tested by the community » Active
steven jones’s picture

Status: Active » Needs work

So 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.

danny englander’s picture

Since the sandbox project is now empty of code (I did a Git clone but all I got was a readme file) and as per the readme in there:

It is all in the 7.x-1.x branch!

... 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 :)

steven jones’s picture

@highrockmedia If follow the instructions on the sandbox page, and clone the git repo like so:

git clone --recursive --branch 7.x-1.x http://git.drupal.org/sandbox/eosrei/1315294.git image_attribute_defaults

Then you will see the code in the 7.x-1.x branch, as per #57.

danny englander’s picture

@Steven Jones - thanks, got it now, that worked but just curious where you saw those instructions? Thanks.

steven jones’s picture

@highrockmedia So you either do what the readme in the master branch told you, and run

git checkout 7.x-1.x

Or follow the instructions on the version control page:
http://drupal.org/project/1315294/git-instructions

LTech’s picture

I 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

jonthomas83’s picture

+1 and subscribing!

o-ar’s picture

Subscribe

skizzo’s picture

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new13.75 KB

Here'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!

ethnovode’s picture

Hello,

Thanks for this patch it is working for me. I just needed to manually edit the .info file to delete the 6.x infos.

plazik’s picture

Status: Needs review » Reviewed & tested by the community

Thanks BWPanda!
The patch works fine. It's time to make a 7.x-dev version!

13rac1’s picture

Just 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!

mhotby’s picture

I'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

deciphered’s picture

@eosrei,

Done, good luck.

13rac1’s picture

Awesome! Thanks.

13rac1’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: Unassigned » 13rac1
Status: Reviewed & tested by the community » Fixed

I 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.

13rac1’s picture

  • Applied BWPanda's changes in another commit.
  • Many other issues have been closed or fixed.
  • Added a list of 7.x-1.0 release blockers to the project page.

Status: Fixed » Closed (fixed)

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