Warning: Undefined array key 1 getAllDisplayModesByEntityType

Created on 17 September 2024, 8 months ago

Problem/Motivation

After enabling history (for forum) we get 'Undefined array key 1...' (see below)

getAllDisplayModesByEntityType() parses the display_mode ids and expects to find a string: entity_type.mode_name eg
media.media_library, user.register, block.token, breaking apart on the '.'

With the history entity_type it just gets 'history' so no array[1]

See same issue in 9.3 https://www.drupal.org/project/drupal/issues/3196247 🐛 Undefined offset: 1 in Drupal\Core\Entity\EntityDisplayRepository->getAllDisplayModesByEntityType() Needs work

Warning: Undefined array key 1 in Drupal\Core\Entity\EntityDisplayRepository->getAllDisplayModesByEntityType() (line 115 of core/lib/Drupal/Core/Entity/EntityDisplayRepository.php).
Drupal\Core\Entity\EntityDisplayRepository->getAllDisplayModesByEntityType('view_mode') (Line: 147)
Drupal\Core\Entity\EntityDisplayRepository->getDisplayModesByEntityType('view_mode', 'block_content') (Line: 78)
Drupal\Core\Entity\EntityDisplayRepository->getViewModes('block_content') (Line: 149)
Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask->getDerivativeDefinitions(Array) (Line: 101)
...

Steps to reproduce

Clear cache - eg with drush cr and you get:
[warning] Undefined array key 1 EntityDisplayRepository.php:115

If cache is rebuilt in the UI the full call tree is available (as above)

Proposed resolution

not sure - add display_mode for history

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.3

Component
History 

Last updated about 20 hours ago

No maintainer
Created by

🇬🇧United Kingdom Jons

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024