array_flip warning when used with moderation_sidebar

Issue information

From user: acbramley

Contribution record

Fork management

Problem/Motivation

The following error is produced when clicking the Moderation sidebar link in the toolbar. This is because the routeMatch finds the moderation sidebar route which doesn't have an entity type's ID route parameter (e.g node), instead it uses entity_type and entity.

Warning: array_flip(): Can only flip string and integer values, entry skipped in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 312 of /data/app/core/lib/Drupal/Core/Entity/EntityStorageBase.php) #0 /data/app/core/includes/bootstrap.inc(347): _drupal_error_handler_real() #1 [internal function]: _drupal_error_handler() #2 /data/app/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): array_flip() #3 /data/app/core/lib/Drupal/Core/Entity/EntityStorageBase.php(296): Drupal\Core\Entity\EntityStorageBase->loadMultiple() #4 /data/app/modules/contrib/entity_hierarchy/src/Routing/ReorderChildrenAccess.php(85): Drupal\Core\Entity\EntityStorageBase->load() #5 [internal function]: Drupal\entity_hierarchy\Routing\ReorderChildrenAccess->access()

Steps to reproduce

Install Moderation sidebar
Click Sidebar link in the Toolbar

Proposed resolution

Either
- Check for $entity being NULL
- OR fallback to a generic entity route parameter key.

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information