Issue #3258782 by murilohp, quietone, dww, catch, Spokje, xjm, daffie, benjifisher, benjifisher, rkoller, AaronMcHale, andregp, Antoniya, ckrina, guilherme-rabelo, guilherme-rabelo, kimberlly_amaral, victoria-mar: Do not display obsolete modules at admin/modules

(cherry picked from commit 8777a76a3f)
merge-requests/1944/head
catch 2022-03-08 11:17:35 +00:00
parent f7ecd6ba45
commit f3fea02d05
3 changed files with 14 additions and 5 deletions

View File

@ -25,10 +25,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides module installation interface.
*
* The list of modules gets populated by module.info.yml files, which contain
* each module's name, description, and information about which modules it
* requires. See \Drupal\Core\Extension\InfoParser for info on module.info.yml
* descriptors.
* The list of modules includes all modules, except obsolete modules. The list
* is generated from the data in the info.yml file for each module, which
* includes the module name, description, dependencies and other information.
*
* @see \Drupal\Core\Extension\InfoParser
*
* @internal
*/
@ -172,6 +173,11 @@ class ModulesListForm extends FormBase {
// The module list needs to be reset so that it can re-scan and include
// any new modules that may have been added directly into the filesystem.
$modules = $this->moduleExtensionList->reset()->getList();
// Remove obsolete modules.
$modules = array_filter($modules, function ($module) {
return !$module->isObsolete();
});
uasort($modules, [ModuleExtensionList::class, 'sortByName']);
}
catch (InfoParserException $e) {

View File

@ -13,7 +13,7 @@ use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Builds a confirmation form for enabling non-stable modules.
* Builds a confirmation form for enabling experimental and deprecated modules.
*
* @internal
*/

View File

@ -57,6 +57,9 @@ class ModulesListFormWebTest extends BrowserTestBase {
// Check that the deprecated module link was rendered correctly.
$this->assertSession()->elementExists('xpath', "//a[contains(@aria-label, 'View information on the Deprecated status of the module Deprecated module')]");
$this->assertSession()->elementExists('xpath', "//a[contains(@href, 'http://example.com/deprecated')]");
// Check that obsolete modules are not displayed.
$this->assertSession()->pageTextNotContains('(Obsolete)');
}
/**