Closed Guite closed 7 years ago
It's also a problem if you have a module's route in the theme template file. When the module is inactive, it throws an error from the template.
Also if you follow https://github.com/zikula/core/blob/1.4/src/docs/Core-2.0/Themes/RouteUsage.md ?
Yeah, wrapping in the modAvailable
throws the error.
no.
if the kernel has the module (or theme) loaded, it is because it is active.
https://github.com/zikula/core/blob/1.4/src/lib/Zikula/Bundle/CoreBundle/Bundle/Bootstrap.php#L57
we do not need a replacement.
there is no way to allow routes of inactive modules to be hardcoded into templates. This is why hardcoding things in a dynamic system is a bad idea.
An error can still be encountered, even if you follow the instructions at https://github.com/zikula/core/blob/1.4/src/docs/Core-2.0/Themes/RouteUsage.md.
Not for me, it works fine in a theme I am currently working on (env prod
, debug true
).
Try upgrading a module. When you go to Extensions to click upgrade on the desired module, the error gets thrown during that process.
it makes sense to me why https://github.com/zikula/core/blob/1.4/src/docs/Core-2.0/Themes/RouteUsage.md would not work - the template interpreter would try to generate the route without respect for the existence check. There is no way around that. The doc is wrong and should be removed.
Why not include in modAvailable, if a module is currently in the progress of being upgraded (when you actually click upgrade), then it is not available, until the api is complete?
We probably need a replacement API for
ModUtil::available()
. Because$this->kernel->getModule('...')
does not check whether the module is activated or not. Thus, event listeners could be executed also for inactive modules.