Updated: Comment #0
Problem/Motivation
The problem is identical to the one described and solved at #2090783: Run comment op links (delete, edit, reply, approve + contrib) through #post_render_cache to prevent render caching granularity being per-user: op links on nodes may be personalized in some way: node access-based, time-dependent, etc. Such links would break the render cache.
Proposed resolution
Use the same solution as the one at #2090783: Run comment op links (delete, edit, reply, approve + contrib) through #post_render_cache to prevent render caching granularity being per-user: leverage #post_render_cache.
A side benefit: statistics.module won't break the render cache anymore, so you can have that module enabled and still benefit from the render cache!
Remaining tasks
None.
User interface changes
None.
API changes
Node links should be altered not through hook_node_view() or hook_node_view_alter(), but through hook_node_links_alter(), which is called from a #post_render_cache callback and therefore can add personalized links without breaking the render cache.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screenshot 2013-12-10 20.41.53.png | 18.51 KB | larowlan |
| #4 | interdiff.txt | 4.57 KB | wim leers |
| #4 | node_ops_links-2151439-4.patch | 12.7 KB | wim leers |
Comments
Comment #1
wim leersEt voila!
Comment #3
xjmBeta blocker as a blocker for #2151459: Enable node render caching.
Comment #4
wim leersThis reroll makes all tests pass.
Comment #5
larowlanAny reason why this doesn't just include the node and save the second entity_load in the callback?
Nice!
Comment #6
wim leersComment #7
larowlanThen I think this is ready
Manually tested on simplytest.me with book module.

Screenshot:
Comment #8
dries commentedThis looks good so I committed it to 8.x. Curious how much impact this will have. We'll have to do extensive profiling later once all the pieces fall into place.
Comment #9
wim leersI, too, am very curious how much impact node render caching will have! We've been working towards it for months now, step by step, so I sure hope it will pay off!
Change notice at https://drupal.org/node/2152957 updated to also explain
hook_node_links_alter().