Blocked by:
- #2941757: Extension System, Part IV: Properly register all installed extensions/namespaces during container generation - Requires all installed extensions to be registered with the container.
Problem/Motivation
Partially represented in the form of ModuleHandler and ThemeHandler already, whereas the list facility of ModuleHandler is actually just the %container.modules% service container parameter at regular runtime.
ThemeHandler has no direct equivalent to ModuleHandler::getModuleList(); i.e., just the map of extension names to filesystem locations.
There is neither a ThemeEngineHandler nor a ProfileHandler yet. We either need to add those, or especially because the extension list logic is the same for all, that asks for a base ExtensionList/ExtensionHandler.
Proposed resolution
Create a base ExtensionHandler that standardizes existing implementations and allows ExtensionHandlerInterface to be used for dependency injections.
Remaining tasks
- Create tests
- Create patch
User interface changes
None
API changes
- Adds
\Drupal\Core\Extension\ExtensionHandlerInterface - Adds
\Drupal\Core\Extension\ExtensionHandler - Adds
\Drupal\Core\Extension\ProfileHandler - Adds
\Drupal\Core\Extension\ThemeEngineHandler - Refactors
ModuleHandlerandThemeHandlerto extend fromExtensionHandler
Data model changes
None
Release notes snippet
TBD
Comments
Comment #2
markhalliwellComment #3
markhalliwellThis is a catch-22.
To get
ExtensionHandlerworking requires installed extensions registered with the container, to get registered extensions requires ExtensionList/ExtensionHandler.Both this issue and #2941757: Extension System, Part IV: Properly register all installed extensions/namespaces during container generation must happen at the same time.
Comment #4
markhalliwellTurns out we can do this in steps after all.
Comment #5
alexpottI'm very circumspect about adding interfaces for extension handling. We don't want to pretend that such services are swappable or even really replaceable. If you want the theme list there is never a case were the module list will do.
Comment #6
markhalliwellI'm thinking a little more long term where the specific "type" of extension handler doesn't necessarily need to be known, just that it follows an interface (e.g. invoking alter). It doesn't have to be an extensive interface (there isn't much overlap), but I think there should be one nonetheless.
This will allow us to do #2954562: [PP-2] Create provider based plugin managers, where the provider requires an extension handler of some kind to proxy requests from the plugin manager.
Comment #7
alexpottYeah but... we're not going to add another extension type. It's not that onerous for a plugin manager to change discovery to support themes if it likes. For example #2920309: Add experimental module for Help Topics introduces a plugin manager that support themes for its plugins.
Comment #8
markhalliwellIt may not be onerous for experienced developers who are extremely familiar with how plugin managers work to hack together something that "technically" supports both (I do have done it, examples in that issue's IS), but that really isn't the point.
We can make the process better and easier for everyone.
I digress. This issue is more about flushing out the plan that was already in place: #2186491: [meta] D8 Extension System: Discovery/Listing/Info.
To have proper interfaces and services that do specific tasks, regardless of how many extension types there are.
Nevermind the current mess that
ExtensionListintroduced by confusing the responsibilities between itself and the existing ModuleHandler/ThemeHandler services.Comment #19
nicxvan commentedI've been thinking about this for quire some time, I don't think we need this.
We've since deprecated theme engines, and Alex's comments still ring very true to me.
Comment #20
nicxvan commented