Problem/Motivation
After upgrade from 10.6.12 to 11.3.13, on doing drush cr I get:
[warning] Undefined array key 1 EntityDisplayRepository.php:115
Steps to reproduce
as above
Debugging, this is connected with a display mode id of "history" where it should be a form like: "node.teaser", ie with a dot joining entity type and display type.
Looking in /admin/structure/display-modes/view and below - there is no 'history'
This may be data left behind from D10?
Part of history module -but doesn't seem to be
Doing drush cget core.entity_view_mode.history gives
uuid: 7ad567ef-0404-4634-8b1d-58682b32705f
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.full
- system.menu.main
module:
- comment
- history
- node
- user
id: history
label: History
description: ''
targetEntityType: null
cache: true
Proposed resolution
have a report to find these malformed entries and convert/delete?
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Comments
Comment #2
cilefen commentedComment #3
jons commentedThis can be resolved by fixing the config yml.
In config/sync/core.entity_view_mode.history.yml
change id to node.history
change targetEntityType to node
then
drush config:import --diffor delete the file then
drush config:import --diffComment #4
cilefen commented@jons, what kind of review are you asking for by setting the status to "needs review"?
Comment #5
jons commentedA Drupal core team member who knows this all better than me!
Comment #6
dcam commentedThere are a few peculiar things about that configuration aside from what you already mentioned. Why does it depend on another view mode and a menu and how could that even happen? Why does it depend on multiple modules when view modes should depend exclusively on the module providing the entity type the mode is for? Why is the
targetEntityTypeNULL?It makes me wonder if someone tried to manually write a view mode configuration by copying and editing entity view/form display config. That doesn't entirely make sense, but it would explain some of the weirdness here.
In any case, deleting the offending configuration as you mentioned in #3 was almost certainly the best course of action. It's what I would have recommended. While I can't imagine that this config was actually being used by the site and it's likely safe to delete without repercussions, I'd test the deletion on a dev site first. Furthermore, I'd grep/search the entire site's code base to look for custom/contrib modules that might be providing this corrupted configuration, just to make certain there's nothing lingering in the site.