Skip to content

Instantly share code, notes, and snippets.

@frazras
Created April 29, 2016 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frazras/765cdaa57bf23521b9792809cb484e9b to your computer and use it in GitHub Desktop.
Save frazras/765cdaa57bf23521b9792809cb484e9b to your computer and use it in GitHub Desktop.
rom 0ab617f74d84ab33e7309f8b567defa5f85c642d Mon Sep 17 00:00:00 2001
From: "Rohan A. Smith" <rohan@bluespark.com>
Date: Fri, 29 Apr 2016 10:23:49 -0400
Subject: [PATCH] AAS-463: Patch for missing image alt data
---
www/sites/all/modules/contrib/media/js/wysiwyg-media.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/www/sites/all/modules/contrib/media/js/wysiwyg-media.js b/www/sites/all/modules/contrib/media/js/wysiwyg-media.js
index 0c5bdd3..b048c84 100644
--- a/www/sites/all/modules/contrib/media/js/wysiwyg-media.js
+++ b/www/sites/all/modules/contrib/media/js/wysiwyg-media.js
@@ -79,6 +79,14 @@ Drupal.wysiwyg.plugins.media = {
// imgElement.attr('view_mode', view_mode);
// Class so we can find this image later.
imgElement.addClass('media-image');
+ if (typeof additional != 'undefined') {
+ if (typeof additional.alt != 'undefined') {
+ imgElement.attr('alt', additional.alt);
+ }
+ if (typeof additional.title != 'undefined') {
+ imgElement.attr('title', additional.title);
+ }
+ }
this.forceAttributesIntoClass(imgElement, fid, view_mode, additional);
if (additional) {
for (k in additional) {
@@ -311,7 +319,7 @@ Drupal.wysiwyg.plugins.media = {
if (additional) {
for (var name in additional) {
if (additional.hasOwnProperty(name)) {
- if (name !== 'alt') {
+ if (name !== 'alt' && name !== 'title') {
imgElement.addClass('attr__' + name + '__' + additional[name]);
}
}
--
2.6.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment