Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently, the block cache is disabled only if a hook_node_grants()
implementation appears via module_implements()
.
However, node access control may also be affected (added, removed) by hook_node_grants_alter()
, and _block_render_blocks()
completely ignores it.
It probably should also disable the block cache if hook_node_grants_alter()
is implemented. Note that this is tangentially related to #1930960: Block caching disable hardcoded on sites with hook_node_grant() causes serious performance troubles when not necessary.
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedIf there are no hook_node_grants() implementations, then doesn't that mean there is nothing for hook_node_grants_alter() to alter?
Also, if you look through the codebase there are tons of places where the Node module itself checks
module_implements('node_grants')
to determine if node access restrictions exist, so even if you write code that goes against the purpose of hook_node_grants_alter() (and try to actually add new access controls there), it is hard to believe it actually works at all in the case where no module implements hook_node_grants() itself....