diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-23 05:51:16 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-11-23 05:51:16 +0000 |
commit | 6dbf951c1f70af741570fe0419c8a36046d39552 (patch) | |
tree | 566043a662891e25333602f6ba123b346b30f8ac /modules/file/file.module | |
parent | 729a23e1a4d062cfcc821ddebd6ffd4631fa360d (diff) | |
download | brdo-6dbf951c1f70af741570fe0419c8a36046d39552.tar.gz brdo-6dbf951c1f70af741570fe0419c8a36046d39552.tar.bz2 |
#939962 by rwohleb, chx, quicksketch: Fixed File field allowed extensions JS broken in Chrome on OS X
Diffstat (limited to 'modules/file/file.module')
-rw-r--r-- | modules/file/file.module | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/file/file.module b/modules/file/file.module index 8b8b9c924..df0d11e34 100644 --- a/modules/file/file.module +++ b/modules/file/file.module @@ -442,10 +442,15 @@ function file_managed_file_process($element, &$form_state, $form) { ); } - // The "accept" attribute is valid XHTML, but not enforced in browsers. - // We use it for our own purposes in our JavaScript validation. + // Add the extension list to the page as JavaScript settings. if (isset($element['#upload_validators']['file_validate_extensions'][0])) { - $element['upload']['#attributes']['accept'] = implode(',', array_filter(explode(' ', $element['#upload_validators']['file_validate_extensions'][0]))); + $extension_list = implode(',', array_filter(explode(' ', $element['#upload_validators']['file_validate_extensions'][0]))); + $element['upload']['#attached']['js'] = array( + array( + 'type' => 'setting', + 'data' => array('file' => array('elements' => array('#' . $element['#id'] . '-upload' => $extension_list))) + ) + ); } // Prefix and suffix used for AJAX replacement. |