- Issue created by @abramm
- ๐ฎ๐ณIndia __i.am.prashant__
__i.am.prashant__ โ made their first commit to this issueโs fork.
The following warning is shown when the View Mode Selector field is created for the entity type for the first time:
Warning: Undefined array key "view_mode" in Drupal\Core\Entity\EntityDisplayRepository->getAllDisplayModesByEntityType() (line 124 of core/lib/Drupal/Core/Entity/EntityDisplayRepository.php).
The same happens if the 'View Mode Selector' entity display is removed.
This is happening because view_mode_selector_entity_view_mode_info_alter
is called from \Drupal\Core\Entity\EntityDisplayRepository::getAllDisplayModesByEntityType
which populates $this->displayModeInfo[$display_type]
and then calls alter hooks. However, the view_mode_selector_entity_view_mode_info_alter
method creates a new display mode which in turn calls \Drupal\Core\Entity\EntityDisplayRepository::clearDisplayModeInfo
and clears previously populated $this->displayModeInfo
array.
Create the first View Mode Selector field for some entity type.
Alternatively, remove the View Mode Selector display mode for any existing entity type and refresh the page.
Observe the warning.
Do not create a display mode config entity in hook_entity_view_mode_info_alter
implementation; probably some field config entity insert hook would be a better place to do this.
None.
None.
None.
Active
1.0
Code
__i.am.prashant__ โ made their first commit to this issueโs fork.