Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
theme system
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
24 Sep 2013 at 09:25 UTC
Updated:
29 Jul 2014 at 22:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
wim leersComment #2
andypostI think it would be good to move drupal_render() out of loop
Comment #3
vijaycs85Addressing #2
Comment #5
mr.baileysThe patch in #3 is causing a fatal error:
Tweaked the patch to avoid the error, also removed the check on empty() since drupal_render takes care of this.
Comment #6
vijaycs85Sorry for the fatal... above patch looks good to go...
Comment #7
damien tournoud commentedThis patch really doesn't fix *anything*. It doesn't brings us closer to removing
drupal_add_css(), because#attach+drupal_render()is actually relying on the same global store for CSS information.I'm not sure why we would pursue a kick-the-can-down-the-road approach like this.
We want to remove the global store for CSS information, which means that the information needs to be stored in a data object (like a Page object) that gets passed around.
Comment #8
catch@Damien, no it's an improvement as it is, just not much of one.
drupal_render() could implement it's own internal storage, which then gets passed up properly whenever it has the opportunity to. That would help with situations like preprocess where there's nothing to #attach to, but where the theme call is actually inside a drupal_render() call that's handling #attached and caching properly. It's very much less than perfect, but at least allows that interim step to be taken.
This particular function never gets called in a place that's particularly affected by global state - it's all 'page-level' functions anyway. But we need to kill off drupal_add_css() as an API function for the places where, then circle back and look at all the direct calls to drupal_render() too. Most of the patches here have been doing #attached properly, but yes there's still plenty of places where there's nothing to #attach to and it does need sorting out.
Comment #9
wim leersIndeed, baby steps.
Comment #10
damien tournoud commentedIt's not baby step, it's kicking the can down the road. It would be more helpful to make sure that we have something to
#attachthose CSS files to in there.