[development] Using array_merge_recursive() in _system_theme_data()

Earl Miles merlin at logrus.com
Thu Dec 25 06:36:55 UTC 2008


Steve Edwards wrote:
> The problem is that both have a [scripts] key, so since duplicates 
> aren't overwritten, only one script array remains.  Which one
> remains depends on the order of the arrays in the statement (i.e. 
> drupal_parse_info_file($theme->filename) + $defaults vs.
> $defaults + drupal_parse_info_file($theme->filename)).

This is actually the intended behavior. To wit, if you didn't specify 
any .js (and also .css) files, then you get the defaults; if you specify 
any, then you get precisely what you specified, and not the default.

Your fix would make it impossible for themes to have a scripts.js and 
for a subtheme to allow it to work; it's similar to the style.css 
problem. And if you don't *want* a scripts.js, well that's just too bad, 
as the defaults say you get one, like it or not. IMO this is bad behavior.

IMO the solution is to simply not have these hidden defaults. They are 
confusing and they existed primarily to allow previous behavior to 
continue, where people were used to having style.css be automatic (and 
script.js being the extension). Hidden defaults like this are dangerous 
and cause confusion. It would be much better, INMSHO, to have all .js 
and .css file declarations be explicit. Simply remove them from the 
defaults entirely, and all will be well.


More information about the development mailing list