When I use this feature it works properly with a basic image (Large, Small ...) It floats to the right or left of the text where it is inserted.
But when I use this same functionality with images Colorbox, formatting like "class": "media-media image-image-right" is lost when I save.
thanks

Comments

kmadel’s picture

Status: Active » Fixed

Fixed with latest dev (won't be available for 12 hours or so), and I will create another beta once it is tested by others.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

murz’s picture

Seems that this feature is broken again on fresh media module (7.x-2.0-unstable7+20-dev) because class and style params moved to 'attributes' sub-array.
Here is my patch that solves this problem for me:

@@ -389,14 +389,14 @@ function media_colorbox_field_formatter_
       $items[0]{$colorbox_caption_field_name}['und'][0]['value'] : NULL;
     }
     //get attributes for item to use on item and wrapping link
-    $class = isset($items[0]['override']['class']) ? $items[0]['override']['class'] : NULL;
-    $style = isset($items[0]['override']['style']) ? $items[0]['override']['style'] : NULL;
+    $class = isset($items[0]['override']['attributes']['class']) ? $items[0]['override']['attributes']['class'] : NULL;
+    $style = isset($items[0]['override']['attributes']['style']) ? $items[0]['override']['attributes']['style'] : NULL;
     
     //variable array for theme_media_colorbox
     $element[0] = array(
         '#theme' => 'media_colorbox',
         '#item_class' => $class,
-        '#item_style' => isset($items[0]['override']['style']) ? $items[0]['override']['style'] : NULL,
+        '#item_style' => $style,
         '#entity_id' => $nid,
         '#file' => $entity,
         '#field' => $field,

Can you review and fix this in core?

murz’s picture

Status: Closed (fixed) » Needs review
charlietoleary’s picture

Priority: Normal » Major
StatusFileSize
new3.29 KB

After having a lot of fun with this bug, I managed to create a somewhat flexible patch for this which should fix this issue in the current dev version.

It involves alterations to media_colorbox_field_formatter_view() implemented in #3 and also a rework of some code in theme_media_colorbox().

Please review attached patch.