The isset($attribute) at line 93 in the module file should probably check the $field attributes if I understand the intent correctly:

        if ($attribute == 'render') {
          $output[] = theme('image_formatter', array('item' => $field, 'image_style' => $type));
        }
        elseif (isset($attribute) && !empty($attribute)) {
          $output[] = $field[$attribute];
        }
        else {
          $output[] = image_style_url($token, $field['uri']);
        }

Like so:

        if ($attribute == 'render') {
          $output[] = theme('image_formatter', array('item' => $field, 'image_style' => $type));
        }
        elseif (isset($field[$attribute]) && !empty($attribute)) {
          $output[] = $field[$attribute];
        }
        else {
          $output[] = image_style_url($token, $field['uri']);
        }

Cheers,
JP

Comments

jpstrikesback’s picture

StatusFileSize
new598 bytes

Here's a patch.

jpstrikesback’s picture

Status: Active » Needs review

status...

byue’s picture

Tried the patch, problems solved! Thank You!

cmonnow’s picture

Issue summary: View changes

I assume you would use something like this instead?

elseif (isset($attribute) && !empty($attribute) && isset($field[$attribute])) {

since you wouldn't check if an array key exists before you've determined the key itself exists?

mediaformat’s picture

patch works!

cmonnow’s picture

But the patch will produce an error if $attribute hasn't been set.

mediaformat’s picture

Errors were still produced.

Here is a new patch based on jpstrikesback and cmonnow's snippets.

maxplus’s picture

Thanks!

#7 solved this issue for me

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • DamienMcKenna committed 5289838 on 7.x-1.x
    Issue #2064275 by jpstrikesback, MediaFormat: Don't assume the field...

Status: Fixed » Closed (fixed)

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