Commit 8777a76a authored by catch's avatar catch
Browse files

Issue #3258782 by murilohp, quietone, dww, catch, Spokje, xjm, daffie,...

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
parent 5fb8e243
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -25,10 +25,11 @@
/**
 * 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 @@ public function buildForm(array $form, FormStateInterface $form_state) {
      // 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) {
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
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
 */
+3 −0
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ public function testModuleListForm() {
    // 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)');
  }

  /**