I would like to see the code for the views plugin be changed to pass back a form rather than the raw HTML that it is now. This actually would go for all plugins in the future. There are a few advantages that I see to this:
* allows us to use standard drupal form functions (particularly validation and alter functions) more predictably
* will let us cleanup some of the very difficult JS that is currently in place
* standardize the media browser on forms which will make it easier for new implementors to follow the pattern
After working on http://drupal.org/node/1016376 it seems to me that it will be much easier to implement a standard file type validation for specific drupal fields if we can do a form alter on the plugin in a standard way. As it stands I'm not sure that it will be easy to do without adding more convoluted code.
The attached patch is a proof of concept. It renders the view output as links over checkboxes and passes those back. There is an error where the file is being stored as a JS value. I think this has to do with the fake submit buttons but I haven't investigated too much further. If there is interest in taking this route I think we could fairly quickly cleanup the existing code. This might shed some light in the dark corners of the legacy code....
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | plugin_form.diff | 5.55 KB | arthurf |
| views_form.diff | 5.56 KB | arthurf |
Comments
Comment #1
arthurf commentedHere's a slightly more abstracted version. Still does not resolve the error on picking the file.
Comment #2
elijah lynnLinked two related issues.
Comment #3
elijah lynnComment #4
dave reidSome quick initial reviews although I think this still holds some promise.
We should have this use file_load_multiple()
If we did a file_load() and passed them into drupal_get_form() shouldn't they still be available in $form_state['build info']['args'] or something similar?
Comment #5
chris matthews commentedClosing this issue as outdated. However, if you think this issue is still important, please let us know and we will gladly re-open it for review.
sincerely,
- the Drupal Media Team