- Issue created by @pingwin4eg
- πΊπ¦Ukraine pingwin4eg Zaporizhia πΊπ¦
Shield module users experience a similar issue - π On View TypeError: Drupal\Core\Entity\EntityTypeManager Active .
- πΊπ¦Ukraine pingwin4eg Zaporizhia πΊπ¦
It seems like the ModuleHandler assumes that
.module
files of all enabled modules are loaded at the moment of hook invokation, and doesn't try to load them "on-demand".On the other hand, the ServerCommand doesn't load
.module
files too.That's weird.
I'll check older branches of core.
- πΊπΈUnited States nicxvan
Does this help π¬ Drupal 11.2 upgrade causes \Drupal::$container is not initialized yet error Active
- πΊπ¦Ukraine pingwin4eg Zaporizhia πΊπ¦
@nicxvan It's not exactly an issue with a contrib module. I think if there was a core module implementing
hook_entity_base_field_info
in a.module
file, the issue would reproduce.And π¬ Drupal 11.2 upgrade causes \Drupal::$container is not initialized yet error Active doesn't help - the same issue even with a patched core.
I checked core 11.0.x (the latest commit as of now), and there is no error - the
.module
file is loaded. And there is almost no difference in theServerCommand
between branches. So I guess the actual reason of the error is somewhere in the hook invocation changes in 11.1. I'm going to trace it further. - πΊπ¦Ukraine pingwin4eg Zaporizhia πΊπ¦
So I see that in Drupal 11.0.x
ModuleHandler
loads.module
files of all installed modules if there's no cached list of hook implementations:EntityFieldManager::buildBaseFieldDefinitions('user') ModuleHandler::invokeAllWith('entity_base_field_info', function (callable $hook, string $module) {...}) ModuleHandler::getImplementationInfo('entity_base_field_info') ModuleHandler::buildImplementationInfo('entity_base_field_info') ModuleHandler::getHookInfo() ModuleHandler::buildHookInfo() ModuleHandler::reload() ModuleHandler::loadAll() // iterates the list of installed modules and calls Extension::load() // includes a .module file if it exists.
This doesn't happen in Drupal 11.x .