Problem/Motivation

The confirmation form (/admin/modules/list/confirm) of module installation displays only the first module that is requiring another module to be installed. It can be reproduced when several modules require the same module (for example, RESTful Web Services and JSON:API require Serialization).

Steps to reproduce

  1. Install a fresh Drupal version (Minimal or Standard profile);
  2. Go to "Extend" page (/admin/modules);
  3. Select "RESTful Web Services" and "JSON:API" and click "Install";

According to the confirmation page, only JSON:API requires Serialization to be enabled. But this is not true 🤷‍♂️

Proposed resolution

Display all modules that require some dependency to be installed.

Remaining tasks

  • Review and decide if UI is good enough (with adding other modules we're duplicating the same sentence multiple times);
  • Code review
  • Update screenshots, include one with multiple dependencies are listed

User interface changes

Before:
confirmation form -> before

After:
confirmation form -> after

Issue fork drupal-3190826

Command icon 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

Matroskeen created an issue. See original summary.

matroskeen’s picture

Issue summary: View changes
matroskeen’s picture

Issue summary: View changes
matroskeen’s picture

Issue summary: View changes
matroskeen’s picture

Status: Active » Needs work
Issue tags: +Needs usability review
benjifisher’s picture

Issue tags: -Needs usability review

Usability review

We discussed this issue at #3191695: Drupal Usability Meeting 2021-01-15. The consensus is that we should have one bullet point (<li> element) for each additional required module. Then list all the selected modules that require it inline. Using the example in the issue summary:

  • You must enable the Serialization module to install the following modules: JSON:API, RESTful Web Services.

It will make the list easier to scan for the additional required modules if each one is listed just once. Also, the current solution could be overwhelming if there are a dozen additional modules, each required by 4 or 5 selected modules.

We did not discuss the exact text to use, so feel free to come up with a variant. I used the format above since it avoids worrying about the "and". If there is only one selected module, then use the existing text.

dinazaur made their first commit to this issue’s fork.

dinazaur’s picture

Status: Needs work » Needs review

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.

nod_’s picture

Status: Needs review » Needs work

Thanks for the patch, it's been a while so the merge request doesn't apply anymore. we'll need to update the code to 10.1.x

samitk’s picture

Assigned: Unassigned » samitk
samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.81 KB
new1.76 KB
nod_’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/system/src/Form/ModulesListConfirmForm.php
    @@ -143,6 +143,23 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +      // Group up modules only if they have the same dependencies.
    +      $normalized_list = [];
    +      foreach ($this->modules['dependencies'] as $module => $dependencies) {
    +        $module_name = $this->modules['install'][$module];
    +        $hash = hash('sha256', implode(', ', array_keys($dependencies)));
    +        if (!isset($normalized_list[$hash])) {
    +          $normalized_list[$hash] = [
    +            'modules' => [$module_name],
    +            'dependencies' => $dependencies,
    +          ];
    +        }
    +        else {
    +          array_push($normalized_list[$hash]['modules'], $module_name);
    +        }
    +      }
    

    Here $normalized_list is not used anywhere.

    The change to the part of the code below is missing.

  2. +++ b/core/modules/system/src/Form/ModulesListForm.php
    @@ -437,14 +437,18 @@ protected function buildModuleList(FormStateInterface $form_state) {
               $dependency_info = $data[$dependency]->info;
    -          $modules['dependencies'][$module][$dependency] = $dependency_info['name'];
    -          $modules['install'][$dependency] = $dependency_info['name'];
    ...
    +            $modules['dependencies'][$module][$dependency] = $data[$dependency]->info['name'];
    +            $modules['install'][$dependency] = $data[$dependency]->info['name'];
    

    would be good to keep the same format as the code it's replacing. There is no reason to change this piece of code, we can add the if around it.

    $dependency_info = $data[$dependency]->info;
    -          $modules['dependencies'][$module][$dependency] = $dependency_info['name'];
    -          $modules['install'][$dependency] = $dependency_info['name'];
nod_’s picture

Issue tags: +Needs careful reroll
benjifisher’s picture

Issue summary: View changes

I have not seen that issue tag before. It looks as though there are currently 6 issues with the tag, all updated within the last week: https://www.drupal.org/project/issues/search?issue_tags=Needs%20careful%....

We have a MR (Comments 1-9) and a patch (Comment 15). I guess the meaning of the issue tag is to start over from the MR and ignore the patch. I am adding an item to the Remaining tasks in the IS.

nod_’s picture

yeah added the little text after:

careful reroll
The patch can be tricky to reroll and some code might get lost in the process. When rerolling this issue please make sure all the parts of the patch are kept (new files, new tests, all the changes to the different parts of the file, changes to es6 files ported to .js files, etc.)

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.

quietone made their first commit to this issue’s fork.

nicxvan’s picture

Component: install system » extension system
quietone’s picture

Component: extension system » install system
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs careful reroll +Needs screenshots

I know this needs updated screenshots but the code is available for a review.

quietone’s picture

Component: install system » extension system
Issue summary: View changes
Status: Needs review » Needs work
quietone’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)

What I failed to realize here is that this confirm form was updated after this issue was created and after the Usability review here. It was in #3086941: Improve the required theme/module installation warning which was committed in Aug 2025. That issue correctly includes the all the dependent modules. That makes this issue a duplicate that can be closed.

Any improvements to the confirm form should be done in a new issue.

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.