I ran into a bug which can be reproduced as follows:

1. Configure the image field on article nodes to use the media widget.
2. Create an article, upload an image via the media browser and add alt/title text to the image.
3. Save the node.
4. Examine the field_data_field_image database table; note that the field_image_alt and field_image_title columns are both NULL for this node (which is as it should be, since the alt and title text were added to the file entity itself, not to the image field on the node).
5. Do a programmatic node_load() + node_save().
6. Examine the field_data_field_image database table again. The field_image_alt and field_image_title columns will now have the values from the file copied into them.

This was causing problems for me on a multilingual site, since anything stored with the image field takes precedence over the values stored on the file (due to the core behavior introduced in #2066275: file_field_load() overwites any field item properties with file entity properties). The image field itself is not translatable on this site (there's no reason for it to be) but the alt/title text fields on file entities are, so this bug was causing the alt/title text to be replaced with English no matter what in certain circumstances. It seems like it could cause problems in other circumstances too, as explained in the code comments in the patch I'll be attaching.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Status: Active » Needs review
FileSize
3.8 KB

Here's the patch.

In theory there could (should?) be an update function here too. I wrote a site-specific one for the site I'm working on, but I don't really know how I'd generalize it. So it's not included in this patch.

David_Rothstein’s picture

Issue summary: View changes