Upload functionality broke due to custom theme_form_element
| Project: | IMCE |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Not sure whether to define this as a bug or a feature request. I caused the problem, but it is allowed to happen because of the assumption that certain parts of theming form elements won't be changed.
Description of the Issue
We created a custom ourtheme_form_element() function in template.php to remove some of the wrapper div's on forms rendered in other parts of our site.
It turns out the Javascript for IMCE must rely on these wrapper div's, classes, id's, etc, since clicking the "Upload" button would do nothing when our custom theme was enabled.
It appears the upload form is defined in inc/page.inc and is run through drupal_get_form('imce_upload_form', $imce_ref) to render the form. This gives the template engine a chance to override the output of theme_form_elements(), which defines the form elements.
Possible Solution
Since the javascript relies on XHTML markup that can be changed through a valid use of Drupal, I wonder if the theming of the upload form and/or it's elements, should use a custom theme of its own that can't be changed by the user.
For instance, setting a $form['#theme'] in imce_upload_form() to use a custom theming function or .tpl for the IMCE upload form. Or, defining a custom $form['imce']['#theme'] and locking the XHTML so the dependent XHTML is always present.

#1
patches are welcome.