file_entity-7.x-2.x-dev
media-7.x-2.x-dev
edit: i also have media-missing-attributes-2067063-22.patch applied
1. I've added an image via the WYSIWYG, but now I want to change the alt tags for that instance of the image.
2. I highlight the image, then click the depressed Media Browser button in the toolbar.
3. I update the alt tags and submit the iframe.
4. I click view source and see the media filter token has been updated with the new text.
5. I save and view the node and the tags are the same as the old tags - ie. its still using the default tags for that file entity.
I can get the behaviour i want via the following hook, but I was wondering if this is a bug or the desired behaviour. Are we meant to be adding alt tags as fields attached to the file entity?
function seed_media_media_token_to_markup_alter(&$element, $tag_info, $settings) {
// This is a hack to get the contents of the alt and title fields into the markup if
// they have been overridden in the media tag (seen when you view source).
// Hopefully this gets fixed in a future version of media.
if (!empty($tag_info['fields']['field_file_image_alt_text[und][0][value]'])) {
$element['content']['file']['#item']['alt'] = $tag_info['fields']['field_file_image_alt_text[und][0][value]'];
}
if (!empty($tag_info['fields']['field_file_image_title_text[und][0][value]'])) {
$element['content']['file']['#item']['title'] = $tag_info['fields']['field_file_image_title_text[und][0][value]'];
}
}
Comments
Comment #0.0
samhassell commentedadded info about patch
Comment #1
ParisLiakos commentedcan you try patch at #2067063: Wysiwyg integration is broken to see if it resolves this?
Comment #2
samhassell commentedTested on a vanilla install and the patch indeed fixes it.
Comment #2.0
samhassell commentedupdated code example