- Issue created by @kim.pepper
- π«π·France andypost
Maybe it could use attribute based discovery instead?
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Hmm. Having a look at π± [META] Hooks via attributes on service methods (hux style) Active this way more complex that I imagined.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
@larowlan pointed out in slack that 'install' checks for hook_requirements run _before_ a module is enabled/loaded, so we can't use services for this.
- π«π·France andypost
Yes, there's no services before installing but composer namespaces are setup-up so discovery is possible
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Related π Deprecate drupal_check_module() and replace with a service Needs review
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Hmm. I guess we could something like:
$requirements = $classResolver->getInstanceFromDefinition("\Drupal\{$module}\Requirements");
That way classes implementing
ContainerInjectionInterface
could have other non-module services injected.I wonder how attributes would help?
Not sure whether this is worth pursuing or not. π€
- πΊπΈUnited States nicxvan
Would you mind my adding this as part of Follow up 3? π [PP-1] Explore converting Install hooks to OOP Active
There are actually two parts to hook requirements, there is a hook requirements for runtime that can be OOP and hook_requirements during install which likely cannot be converted.