Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291122

drupal_get_css() should return early if $css is empty.

$
0
0

As I discovered in comment #58 in #2005970: In renderable arrays, #type should provide a #theme suggestion, similar to how drupal_prepare_form() works, drupal_get_css() will try to process an empty $css array when it could just return an empty string straight after the alter that allows modules to modify the array if it is still empty.

$css is generally only empty during ajax requests it seems.

Not returning early means it would be impossible for somebody to implement #theme 'styles' without causing exceptions on ajax requests, as the drupal_render() in drupal_get_css() would cause the theme system to initialise inappropriately.

Doing a quick empty() check would also be a slight performance boost for ajax pages.

This is probably minor in itself, but it's kind of blocking #2005970: In renderable arrays, #type should provide a #theme suggestion, similar to how drupal_prepare_form() works.


Viewing all articles
Browse latest Browse all 291122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>