Problem/Motivation
#2473873: Entity operations lack cacheability support, resulting in incorrect dropbuttons added a $cacheability parameter to hook_entity_operation() and hook_entity_operation_alter(). #3540105: Capture access cacheability in getDefaultOperations() methods for all relevant entity list builders updated the list builders to use it, but the hook implementations in core modules still only take $entity. Their access checks don't add any cacheability, so the operations they add can be cached for the wrong users.
These are in the PHPStan baseline as drupal.hookEntityOperationMissingCacheabilityParameter and drupal.hookEntityOperationAlterMissingCacheabilityParameter.
Steps to reproduce
grep -A2 hookEntityOperation core/.phpstan-baseline.php | grep path
Proposed resolution
Add the $cacheability parameter to each implementation and add the access cacheability to it.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3642709
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mukesh-kumar3 commentedI'd like to work on this. To keep the MR reviewable, I'll start with taxonomy, block_content and menu_ui. Should I do everything in one MR, or is a split per module (child issues) preferred?
Comment #4
mstrelan commentedLet's see what one combined MR looks like. If it's too big we can split it.
Comment #6
mukesh-kumar3 commentedCompleted the combined implementation in MR !18049, including
cacheability handling, regression tests, test-hook signature updates,
and removal of obsolete PHPStan baseline entries.
Pipeline #1076750 completed with all blocking jobs passing.
Two allowed-to-fail PHP 8.6 unit-test jobs remain as warnings.
Ready for review.
Comment #7
mukesh-kumar3 commentedComment #8
mukesh-kumar3 commentedComment #9
mukesh-kumar3 commented