AssetResolver::getCssAssets() should not try to sort and optimise if $css is empty.

Created on 2 July 2013, about 11 years ago
Updated 2 November 2023, 10 months ago

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 .

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Asset library 

Last updated 1 day ago

No maintainer
Created by

🇦🇺Australia thedavidmeister

Live updates comments and jobs are added and updated live.
  • Performance

    It affects performance. It is often combined with the Needs profiling tag.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024