First many thanks for this module that was more than useful to me.
When I tried to use it, I got the error :
Notice : Undefined offset: 0 dans theme_file_upload_help() (ligne 930 de /var/www/html/espace_client_v3/modules/file/file.field.inc).
This is because the case of an empty array for $upload_validators['file_validate_extensions'] is not handled.
As I didn't want to modify Drupal core's code for maintainabilty reasons (would be lost when I update Drupal core), I fixed it by adding the following to your module :
function allow_all_file_extensions_theme_registry_alter(&$theme_registry) {
if(isset($theme_registry['file_upload_help']))
{
$theme_registry['file_upload_help']['preprocess functions'] = array('theme_file_upload_help_preprocess');
}
}
function theme_file_upload_help_preprocess(&$variables) {
if (isset($variables['upload_validators']['file_validate_extensions'])) {
if(empty($variables['upload_validators']['file_validate_extensions'])){
unset($variables['upload_validators']['file_validate_extensions']);
}
}
}
The result is that the help line Allowed extensions is not displayed.
I'm sorry I'm not at all familiar with patching (I've just created a Drupal account to let you know about it) so I give you my fix and if you like it you can patch your module.
Thanks again
-David
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | allow_all_file_extensions-error-due-to-theme_file_upload_help-1815632-4.patch | 844 bytes | nwom |
Comments
Comment #1
lolmaus commentedHey dungeon_dave, i've added your code (omitting <? ?>) to allow_all_file_extensions.module and it didn't solve the issue.
What am i doing wrong?
Comment #2
monaw commentedThe code worked for me.
@ lolmaus - did you try clearing your cache a few times?
Comment #3
nwom commentedComment #4
nwom commentedHere is a patch based on the above code. Thanks for providing it. So far the patch works without issues. Please review.