Blocked by:

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 ModuleHandler and ThemeHandler to extend from ExtensionHandler

Data model changes

None

Release notes snippet

TBD

Comments

markcarver created an issue. See original summary.

markhalliwell’s picture

Title: Extension System, Part IV: ExtensionHandler and ExtensionHandlerInterface » [PP-1] Extension System, Part IV: ExtensionHandler and ExtensionHandlerInterface
Issue summary: View changes
Status: Active » Postponed
Parent issue: » #2186491: [meta] D8 Extension System: Discovery/Listing/Info
Related issues: +#2941757: Extension System, Part IV: Properly register all installed extensions/namespaces during container generation
markhalliwell’s picture

Status: Postponed » Closed (duplicate)

This is a catch-22.

To get ExtensionHandler working 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.

markhalliwell’s picture

Status: Closed (duplicate) » Postponed

Turns out we can do this in steps after all.

alexpott’s picture

I'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.

markhalliwell’s picture

I'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.

alexpott’s picture

Yeah 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.

markhalliwell’s picture

It 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 ExtensionList introduced by confusing the responsibilities between itself and the existing ModuleHandler/ThemeHandler services.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

nicxvan’s picture

Status: Postponed » Postponed (maintainer needs more info)

I'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.

nicxvan’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.