Problem/Motivation
It became possible to have themes depend on modules in #474684: Allow themes to declare dependencies on modules. In this implementation, the dependee-modules must be enabled in admin/modules before a module-depending theme can be enabled.
Ideally, it would be possible to enable the dependent modules as part of enabling the theme. This was not part of the initial implementation due to the complexities of permissions and confirmation forms when both themes and modules are being enabled.
A partial implementation was added in an earlier iteration of the patch #474684: Allow themes to declare dependencies on modules, once it was apparent that additional validation (including experimental modules) was needed, it was decided that this was better addressed in a followup.
Proposed resolution
Determine how to best implement module-enabling validation in both admin/modules and when enabling module-dependent themes.
Then implement that.
Remaining tasks
Ensure modules that enabled themes depend on cannot be uninstalled.
Handle forms that extend the newly deprecated: ModulesListConfirmForm
User interface changes
...
API changes
...
Data model changes
...
Release notes snippet
...
| Comment | File | Size | Author |
|---|
Issue fork drupal-3100374
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nedjo#474684: Allow themes to declare dependencies on modules has been committed so this can be set to Active.
Comment #4
saschaeggiThis would also be very useful for other admin themes like Gin or Adminimal to automatically enable the toolbar helper module for the frontend.
So +1 on this.
Comment #5
bnjmnmThis adds the ability to enable modules via the theme installer, and test coverage has been modified to confirm this works. Additional tests are still needed for the new criteria that can trigger a confirmation form on module install - experimental modules or indirect dependent modules.
Comment #6
bnjmnmTests added
Comment #7
fhaeberleThis would be awesome and the missing bit of enabling a theme with modules, also a much more convenient UX. So +1
Comment #9
raman.b commentedCreated change records, updated deprecation messages for 9.2.x and resolved few CS issues.
Comment #10
saschaeggiGlad so see some activity in here :)
Comment #11
bnjmnmThis addresses a few things surfaced by the committer test tools being made available to all contributors.
I also tried to address the Nightwatch test failure in #9 and I'm a bit confused as to what is happening. The claroAutocompleteTest is failing in a very early step: after the "FormAPI Test" module is enabled via the UI, the test expects a confirmation form for enabling the additional dependent modules. This is challenging as
nightwatch_testingprofile, and the confirmation form also appears.Although the local/manual tests work, the changes we've made here specifically target extension confirmation forms so it's entirely possible claroAutocompleteTest has surfaced an edge case that actually needs fixing, as opposed to this being a false alarm related to test config. I wasn't able to figure that out, but perhaps someone else can?
Comment #12
manuel garcia commentedComment #13
mirom commentedThis is just fixing the coding standard failure from the previous run.
Comment #21
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #22
damienmckennaThis is a definite DrupalWTF as theme builders should expect that listing a module as a dependency of their theme would make it work the same as on another module.
Working on a reroll.
Comment #23
damienmckennaRerolled, hopefully successfully; the only part I'm not 100% about are the changes to core/lib/Drupal/Core/Extension/ThemeInstaller.php, some refactoring had already been done there on another issue.
Comment #24
damienmckennaPatch #23 was against 9.5.x. This patch is for 10.1.x
Comment #25
bnjmnmComment #26
bnjmnmThings have been deprecated in the time that passed since the last working patch ⏰⏰⏰⏰💀
Comment #27
smustgrave commentedSeems there were some failures.
Love the idea though as I would make my themes require the components module.
Comment #28
bnjmnmI believe some (maybe all) of the remaining test failures are due to #3215043: Indicate the non-stable statuses in admin/modules page. This made some nice changes to the module form experience, but will require the logic in this issue to be updated to account for the differences.
Comment #30
dave reidOur install profile has a base theme that requires modules, and we realized because of this issue, our install profile cannot be installed anymore because the installer installs themes before modules. I would say this is a bug more than a feature request at this point.
Comment #31
kristen polSwitching to bug per #30.
Comment #32
liam morlandComment #36
ivnishMR for Drupal 11 is 90% ready. Needs to fix some phpstan issues. I don't have time to deal with this task anymore.
Comment #37
martijn de witthank you for all the work @ivnish ! 🙏
Comment #40
nicxvan commentedComment #41
nicxvan commentedI'll take a look.
Comment #42
nicxvan commentedAddressed the phpstan issues in the new extensionconfirm form. Added some items to the remaining tasks.
Still needs work.
I think there might be something missing for uninstalling modules when a theme is enabled, I didn't look close enough. We do need to handle the forms extending the newly deprecated form, and most likely create new ones.
There are also things like this:
if (isset($theme) || $this->themeInstaller->install([$theme])) {$theme is always set there, it used to be $themes[$theme] I've not read through the code enough to know why that changed.
Comment #43
nicxvan commentedOk I fixed the CS errors.
I also undid the module confirm deprecation because extension confirmation doesn't cover what moduleslistunstableconfirmform needs.
This probably needs some additional work, but I think tests will run.
Edit: I'm not sure how to fix that last phpstan issue.