Issue #3606806: Fix getDefaultOperations() signature for Drupal 12 CacheableMetadata param

Description:

Fixes #3606806

Problem

Drupal 12 added a required second parameter to EntityInterface::getDefaultOperations():

public function getDefaultOperations(EntityInterface $entity, ?CacheableMetadata $cacheability = NULL)

EntityQueueListBuilder overrides this method with only the original single-parameter signature, causing a fatal InvalidArgumentException ("Too few arguments") when the Drupal 12 entity list builder invokes getDefaultOperations() on any entity queue list page.

Solution

  • Add use Drupal\Core\Cache\CacheableMetadata; to the class imports
  • Update the method signature to match the parent: getDefaultOperations(EntityInterface $entity, ?CacheableMetadata $cacheability = NULL)
  • Pass $cacheability through to parent::getDefaultOperations()

The parameter is nullable with a default of NULL, so this change is fully backward-compatible with Drupal 10 and 11.

Testing

Tested on Drupal 12.0-dev / PHP 8.5. Before this fix: visiting /admin/structure/entityqueue throws a fatal error. After: the queue list renders correctly with all operations available.

Merge request reports

Loading