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.
Following the discussion on https://www.drupal.org/node/1080386#comment-10838412.
When using the Media browser
widget for an a image. I cannot map the alt
and title
fields.
The field values are stored in the tables field_data_field_file_image_title_text
and field_data_field_file_image_alt_text
- not in field_data_field_image
which occurs when the widget Image
is chosen.
Comments
Comment #2
abelass CreditAttribution: abelass commentedComment #3
siramsay CreditAttribution: siramsay as a volunteer commentedI am looking at importing images and need to map alt and title fields to a image field type using media browser widget.
did you manage to find a solution?
Comment #4
jerry CreditAttribution: jerry commentedI'd be very interested in a way to target the alt and title fields of images imported into file entities via multi-value image fields.
Comment #5
siramsay CreditAttribution: siramsay as a volunteer commentedAfter looking into this I am unsure if this is the right place for this unless you wanted to make some mappers for the Media alt and title fields. This would need to be done using a feeds hook, maybe hook_feeds_after_import, as you need to know the image fid so the relationship can be made between the alt and title and image.
However feeds already has mappers for the alt and title so if this is all you want to map then you don't need Media Feeds at all. You can use these mappers and then sync after import.
To sync after import you need VBO and a small custom module that I will post below soon but you can check here #2070183: Sync alt and title text between file entity and standard image field.
What I do is import bulk nodes, go to content page, bulk save the new content with VBO and clear cache. I will posted more notes soon below. But as stated Media Feed is not needed.
Comment #6
besek CreditAttribution: besek commentedHi size,
did you managed to create this custom module? I'm asking, because I have the same issue and I'm trying to find a way to automatically synchronise content from
field_image_alt
intofield_data_field_file_image_alt_text
after each feeds import.Comment #7
siramsay CreditAttribution: siramsay as a volunteer commentedas stated Media Feed is not needed.
I just used #2070183-7: Sync alt and title text between file entity and standard image field (comment #7)
and then
I have found that if you do use Update existing nodes in node processor of the feed importers setting page, then from initial testing no need to re-save nodes as on update node is saved.
It is the saving of the nodes that sync alts and title module is run. This could be written as a module but don't really think this is the right place for it as Media Feed is not needed.
Comment #8
siramsay CreditAttribution: siramsay as a volunteer commented