Problem/Motivation
[#2151609] (change record: https://drupal.org/node/2151609) added #post_render_cache
, which allows placeholders to be cached and a callback to be executed after each render cache hit, to do any necessary personalization.
For simple cases like #2090783: Run comment op links (delete, edit, reply, approve + contrib) through #post_render_cache to prevent render caching granularity being per-user and #2151439: Run node op links ("Read more", "Add child page", "Printer-friendly version", "X views" + contrib) through #post_render_cache to prevent render caching granularity being per-user (change record: https://drupal.org/node/2152957), there is no problem: they only generate HTML, and don't affect anything except that placeholder: no additional headers, no additional assets, nothing — except for locally replaced HTML.
However, there are also more complex cases, like the comment form for authenticated users. We had to generate this in a #post_render_cache
callback because otherwise nodes would not be render cacheable by default, since the comment form is rendered as part of the node by default. It works, but the comment form is a completely different thing than a simple set of links: it can cause additional assets to be attached to the page — for example, a WYSIWYG editor.
In other words: this will break once asset handling is no longer stored in a global static variable.
Proposed resolution
No proposal yet, only possibilities:
- Forbid
#attached
, which implies we either have to either- Render the comment form outside of the node
- Remove the option to render the comment form on the same page as the node.
- Allow
#attached
and come up with a way of bubbling up assets.
Remaining tasks
TBD
User interface changes
TBD
API changes
TBD
Comments
Comment #1
BerdirI assume this got fixed in other issues? :)
Comment #2
Wim LeersYes! :)