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

Command icon 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

mstrelan created an issue. See original summary.

mukesh-kumar3 made their first commit to this issue’s fork.

mukesh-kumar3’s picture

Assigned: Unassigned » mukesh-kumar3

I'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?

mstrelan’s picture

Let's see what one combined MR looks like. If it's too big we can split it.

mukesh-kumar3’s picture

Status: Active » Needs review

Completed 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.

mukesh-kumar3’s picture

Assigned: mukesh-kumar3 » Unassigned
mukesh-kumar3’s picture

Assigned: Unassigned » mukesh-kumar3
mukesh-kumar3’s picture

Assigned: mukesh-kumar3 » Unassigned