Upon dsm() inspection of $form_state on line 331 in function media_browser_plus_submit($form, &$form_state) $form_state['redirect'][1]['query']['fid'] does not exist. Only $form_state['redirect'][1]['query']['destination'] exists at this level.

Comments

brentratliff’s picture

Possibly related Warning on the same action:

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in EntityCacheControllerHelper::entityCacheLoad() (line 64

brentratliff’s picture

Changing line 332 to: $fids = $form_state['file']->fid; fixes the issue and correctly applies the tags for single images. It does not work for multiple images using plupload.

brentratliff’s picture

duplicate .....

brentratliff’s picture

StatusFileSize
new1.05 KB

This patch fixed it for me. Probably not the most elegant way to handle it. It has to check whether one or more files are uploaded in order to grab the fid from the right place. I rolled it from the 2012-02-25 2.x dev tarball.

anandkp’s picture

I've applied the patch in comment #4 above and it worked beautifully, but there is still a PHP notice.

I don't know how to make Git patches so if someone with the know-how could update the patch above that would be great. The complaint is a for a very tiny thing... See code below:

<?php
// The condition "if ($form_state['files'])" can cause PHP to say that it cannot find the index 'files'
  if ($form_state['files'])   {
    foreach ($form_state['files'] as $i => $fid)  {
      $fids[$i] = $fid->fid;
      $i++;
    }
  }


// Changing the if() condition to include isset() fixes this.
  if (isset($form_state['files']))   {
    foreach ($form_state['files'] as $i => $fid)  {
      $fids[$i] = $fid->fid;
      $i++;
    }
  }

?>

If anyone can update the patch, that would be great! Thanks to the module maintainers and the persons who looked into the cause and fix for this issue!

Jackinloadup’s picture

StatusFileSize
new748 bytes

Here is a reroll as requested in #5.

I haven't tested this patch.

Can someone describe how to reproduce this? I've never experienced this myself.

das-peter’s picture

Status: Active » Fixed

I've drilled a bit deeper and it heavily depends on the module version of media / file_entity how the structure looks.
Thus I committed a slightly different version which should support the former and current versions of the modules: http://drupalcode.org/project/media_browser_plus.git/commit/6249eeb6c118...

Status: Fixed » Closed (fixed)

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