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:

  1. Forbid #attached, which implies we either have to either
    1. Render the comment form outside of the node
    2. Remove the option to render the comment form on the same page as the node.
  2. Allow #attached and come up with a way of bubbling up assets.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Comments

Berdir’s picture

Assigned: Unassigned » Wim Leers
Status: Active » Postponed (maintainer needs more info)

I assume this got fixed in other issues? :)

Wim Leers’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Yes! :)