- Issue created by @earthday47
- π©πͺGermany hctom
Thanks for the report. This is a strange problem, because core's
hook_entity_view_mode_alter
documentation says, that it MUST be a string. I am also using this module in combination with custom block types and I have never experienced this issue so far.Do you have some more information (e.g. if it is an inline block in layout builder or a normal custom block, list any other modules that may interfere here in your setup) for me, that helps to get an understanding of this issue?
- πΊπΈUnited States earthday47 New York
Here's some more details I can provide -
- The error was triggered on entity of type "block_content"
- It is a custom block type with only a body field. There were no customizations made to any other view modes so this would be trying to use the 'default' view mode.
- This site, and this block content, was upgraded from Drupal 8->9->10.
So it's possible this is a migration issue?
- Status changed to Needs review
10 months ago 7:17pm 26 January 2024 - Status changed to Postponed: needs info
10 months ago 7:23pm 26 January 2024 - π©πͺGermany hctom
To be honest, I also think that this may have something to do with the migration. I double checked the core code invoking this alter hook (in
EntityViewBuilder::getBuildDefaults()
) and everywhere only string are used and all calling methods usefull
as fallback value for their$view_mode
arguments. So either there is some code that tries to render blocks programmatically with an explicitly setNULL
value for$view_mode
when callingANY_ENTITY_LIST_BUILDER::viewMultiple()
or your migrated blocks are somehow causing this issue (which is really hard to identify from far away).So please use your patch for now and I am setting the issue's priority back to "Normal" and status to "Needs more info", because the code itself follows core's argument value type.
If you have any other information that might help here, feel free to update this issue.
- πΊπΈUnited States earthday47 New York
I checked and the block is placed using the default block layout. But the patch will work for in the short term.
If I have more information I'll definitely update! Thanks for your quick responses! - π©πͺGermany hctom
Hi @earthday47, I just wanted to know, if you found something that caused this issue or have any new information for me? If so, feel free to re-open or update this ticket, please. Thanks!
- Status changed to Closed: works as designed
7 months ago 1:39pm 27 April 2024 - π©πͺGermany hctom
I am closing this ticket now, because there was no feedback anymore. Feel free to open a new issue, if there is still an issue with this module.