Verified Commit 19a37c38 authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #2845241 by dcam, arunkumark, nitin_lama, suryakumar,...

Issue #2845241 by dcam, arunkumark, nitin_lama, suryakumar, sivaji_ganesh_jojodae, abhijith s, LG666, borisson_, nod_: If a permission's machine name is the same as its module's machine name, the Extend UI is visually broken
parent 23f9b781
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {

    foreach ($this->permissionsByProvider() as $provider => $permissions) {
      // Module name.
      $form['permissions'][$provider] = [
      $form['permissions']['module_' . $provider] = [
        [
          '#wrapper_attributes' => [
            'colspan' => count($role_names) + 1,
+2 −0
Original line number Diff line number Diff line
@@ -4,3 +4,5 @@ a:
  title: 'Test permission'
b:
  title: 'Test permission'
user_permissions_test:
  title: 'Permission with the same name as the module'
+16 −0
Original line number Diff line number Diff line
@@ -352,4 +352,20 @@ public function testOverriddenPermission(): void {
    $this->assertSession()->checkboxNotChecked('anonymous[access content]');
  }

  /**
   * Tests that module header rows in the permissions table have a single cell.
   */
  public function testPermissionTableHtml(): void {
    $this->drupalLogin($this->adminUser);

    \Drupal::service('module_installer')->install(['user_permissions_test']);
    $this->drupalGet('admin/people/permissions');

    // Verify that if a permission has the same name as a module, that its
    // table cells aren't combined into the module's header row. The header row
    // should have a single cell in that case.
    $header_row = $this->xpath('//tr[@data-drupal-selector=\'edit-permissions-module-user-permissions-test\'][count(td)=1]');
    $this->assertNotEmpty($header_row);
  }

}