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.
A patch was recently developed that will add the alt and title attributes to the image fields using the media file selector: http://drupal.org/node/1307054
The patch is supposed to work on a fresh installation but it it does not provide a migration path to convert the already existing image fields that have data in them.
Opening this issue in order to develop a patch/upgrade/migration path/anything that will add the alt and title attributes to the already existing and populated image fields.
Comments
Comment #1
kirilius CreditAttribution: kirilius commentedMoving this up as the problem is still there and the fix itself does not accommodate any existing fields.
Comment #2
MXTI need this feature too.
But I don't know if this is the correct issue queue to use, because Media migration is currently handled in migrate_extras module.
The absurd is that migrate_extras is currently unsupported due to the reason explained in the migrate_extras project page: in short, all migration stuff should be managed directly by involved modules.
So I think is time for Media module to manage by itself all migration stuff, but in the same time all the media migration management should be removed from migrate_extras to avoid conflicts...
I don't know, it would be useful the maintainers opinions...
Thank you very much for considering this
Comment #3
MXTI've tried to set title and alt values in my prepare or complete functions, but without success.
No values are saved:
What is strange, is that the last dpm($node) shows the values setted correctly, but at the end values are not registered.
Same thing with complete function.
Where is the error?
Thank you for any help
Comment #4
fietserwinI wrote some SQL queries myself. This could be used by others, assuming your situation is more or less the same as mine. so use at your own risk but do post your results/findings/improvements here.
Data to migrate
The data can be found in the data tables for all image fields. Revisioning and deletions are ignored here.
Source
table name
field_data_field_{name} (thus 1 table per image field)
fields
Destination
table name
field_data_field_file_image_alt_text
Fields (and the source of their value)
table name
field_data_field_file_image_title_text
Fields (and the source of their value)
table name
field_revision_field_file_image_alt_text
field_revision_field_file_image_title_text
Exact copies of the field_data_field_... versions.
Problems to expect
Queries
The above observations result in 4 queries per image field:
Conclusions
I tested the queries locally and everything went well. However, changing this into an update hook or migrate function or module is not straightforward. The problems mentioned should be tackled because eventually there will be a site that does have multiple usages of the same image with different alt/title texts. Also the way that revisioning and deletions are handled should be decided on before creating a function/feature/module for general use.
Media module (maintainers) should ask themselves if this is the correct level to store alt and title text info or that it should be possible to define/override it at the usage level.
Comment #5
MJD CreditAttribution: MJD commentedI've just had the same problem as #3 above https://www.drupal.org/node/1905764#comment-7378688
I think that should have worked but in the end I did a work around as the image alt / title texts never survived my node_save.
Thanks to this post https://www.drupal.org/node/1438668#comment-5603114 that gave me the start I needed
Comment #6
mgiffordThis other issue is fixed now - #1307054: Accessibility - Media browser image alt and title fields
I don't know if there is "anything that will add the alt and title attributes to the already existing and populated image fields."
Comment #7
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team