Unverified Commit da50a859 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3245622 by dww, mgifford, darvanen, AaronMcHale, Antoniya, anagomes,...

Issue #3245622 by dww, mgifford, darvanen, AaronMcHale, Antoniya, anagomes, andrewmacpherson, beatrizrodrigues, benjifisher, rkoller, shaal, marcos_lima, lucienchalom, ckrina, gabrielda, kjay: Module name context missing for 'help' and 'permissions' links on admin/modules

(cherry picked from commit 67b083bf)
parent bbc518ad
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -259,9 +259,9 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
    if ($this->moduleHandler->moduleExists('help') && $module->status && in_array($module->getName(), $this->moduleHandler->getImplementations('help'))) {
      $row['links']['help'] = [
        '#type' => 'link',
        '#title' => $this->t('Help'),
        '#title' => $this->t('Help <span class="visually-hidden">for @module</span>', ['@module' => $module->info['name']]),
        '#url' => Url::fromRoute('help.page', ['name' => $module->getName()]),
        '#options' => ['attributes' => ['class' => ['module-link', 'module-link-help'], 'title' => $this->t('Help')]],
        '#options' => ['attributes' => ['class' => ['module-link', 'module-link-help']]],
      ];
    }

@@ -269,9 +269,9 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
    if ($module->status && $this->currentUser->hasPermission('administer permissions') && $this->permissionHandler->moduleProvidesPermissions($module->getName())) {
      $row['links']['permissions'] = [
        '#type' => 'link',
        '#title' => $this->t('Permissions'),
        '#title' => $this->t('Permissions <span class="visually-hidden">for @module</span>', ['@module' => $module->info['name']]),
        '#url' => Url::fromRoute('user.admin_permissions.module', ['modules' => $module->getName()]),
        '#options' => ['attributes' => ['class' => ['module-link', 'module-link-permissions'], 'title' => $this->t('Configure permissions')]],
        '#options' => ['attributes' => ['class' => ['module-link', 'module-link-permissions']]],
      ];
    }

@@ -281,7 +281,7 @@ protected function buildRow(array $modules, Extension $module, $distribution) {
      if ($this->accessManager->checkNamedRoute($module->info['configure'], $route_parameters, $this->currentUser)) {
        $row['links']['configure'] = [
          '#type' => 'link',
          '#title' => $this->t('Configure <span class="visually-hidden">the @module module</span>', ['@module' => $module->info['name']]),
          '#title' => $this->t('Configure <span class="visually-hidden">@module</span>', ['@module' => $module->info['name']]),
          '#url' => Url::fromRoute($module->info['configure'], $route_parameters),
          '#options' => [
            'attributes' => [
+3 −3
Original line number Diff line number Diff line
@@ -41,13 +41,13 @@ public function testModuleListForm() {
    $this->drupalGet('admin/modules');

    // Check that system_test's configure link was rendered correctly.
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='the System test module']");
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/system-test/configure/bar') and text()='Configure ']/span[contains(@class, 'visually-hidden') and text()='System test']");

    // Check that system_test's permissions link was rendered correctly.
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/people/permissions/module/system_test') and @title='Configure permissions']");
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/people/permissions/module/system_test') and text()='Permissions ']/span[contains(@class, 'visually-hidden') and text()='for System test']");

    // Check that system_test's help link was rendered correctly.
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/help/system_test') and @title='Help']");
    $this->assertSession()->elementExists('xpath', "//a[contains(@href, '/admin/help/system_test') and text()='Help ']/span[contains(@class, 'visually-hidden') and text()='for System test']");

    // Ensure that the Database Logging module's machine name is printed. This
    // module is used because its machine name is different than its human