Give the gift of Drupal. All merchandise is 50% off through 2016.
Earlier today I was given the task of making a filefield in a CTools Content Type (I.e., a panel) admin form accept multiple items. I figured plupload would be the easiest way to do this, and so went about doing so. For an idea of what I'm doing, check out this tutorial.
The better part of a day later, here are some findings:
a. Form handling in a CTools plugin is somewhat different than in a normal module.
b. For some reason, plupload's CSS would simply not work. I had to use the following block of awful code to make it work: Edit: The way I had it before was breaking plupload UI images. I was placing the drupal_add_css/ctools_add_css call too late in the execution chain. Kind of annoying it wouldn't enqueue by default, but nothing too complex.
c. I can't get the description field to say anything except all the default filetypes available to Drupal. I think this is because #description is passed to theme(), which I'm guessing CTools doesn't use for its admin forms. Any idea how to get around this (Beyond hiding the whole thing with CSS)? Edit: missed the "file_validate_extensions" option.
d. It doesn't seem like plupload is adding anything to file_managed. I have no idea why this is. Any help?
e. Is there any way to call a function after each image upload? I tried using the patch at http://drupal.org/node/1715374#comment-6328588 but I can't seem to get that hook to work. Ultimately I need to rebuild the entire form after each upload (The plugin displays previous images in the table like Media -- though not through Media). Edit: I was able to get that hook to work, though I'm still not sure how to set $form['rebuild'] when that hook doesn't really take anything form-related.