The multiselect parameter will always resolve true in the media library plugin. This is because the parameter is text in JS and is being checked like a boolean.

This patch addresses the issue

Comments

Status: Needs review » Needs work

The last submitted patch, media-multiselect.patch, failed testing.

JacobSingh’s picture

http://drupal.org/node/948700
Does it really come as a string? I remember testing this and it workign fine
can we make it come as a bool instead of hacking the receiving end?
should I be commenting on the issue?
Find out next week on Rocky and Bulwinkles...
jelliot
2:15
yeah, it's coming as a text string
I'm not a fan
I think it's being pulled in from the query string and not getting converted to a bool
2:16 Also, I just found a patch on fisheye that I didn't put up on d.o

james.elliott’s picture

Status: Needs work » Needs review
StatusFileSize
new2.32 KB

New patch after chatting with JacobSingh

*crosses fingers that the patch applies cleanly*

JacobSingh’s picture

why do we need this:

  $multiselect = isset($params['multiselect']) ? $params['multiselect'] : FALSE;
-  
+
+  // The multiselect parameter is a string.  So we check to see if it is set and
+  // adjust the local variable accordingly.
+  if (isset($params['multiselect']) && $params['multiselect'] != 'false') {
+    $multiselect = TRUE;
+  } else {
+    $multiselect = FALSE;
+  }
+

if multiselect is not desired, it should just not be passed. I suppose supporting false is a good thing to do anyway to avoid confusion, so if we do that, make it:

$multiselect = FALSE;
if (isset($multi.. && $multi != 'false') {
  $multi= true.
}

-      $upload_form = drupal_get_form($upload_form_id, $types);  
+
+      $upload_form = drupal_get_form($upload_form_id, $types);

This change looks like line ending fun.

JacobSingh’s picture

Simpler. If you want to use an else, it should go on its own line in Drupal. I personally hate this, but it is the rule.

james.elliott’s picture

StatusFileSize
new2.3 KB

Agree with the first point. The second is actually removal of whitespace.

JacobSingh’s picture

Status: Needs review » Reviewed & tested by the community
james.elliott’s picture

committed

aspilicious’s picture

Status: Reviewed & tested by the community » Fixed

fixed?

james.elliott’s picture

Yes, thank you.

Status: Fixed » Closed (fixed)

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