Verified Commit 9daaabee authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3351638 by swirt, lauriii, larowlan, mgifford, bnjmnm, smustgrave,...

Issue #3351638 by swirt, lauriii, larowlan, mgifford, bnjmnm, smustgrave, maggiewachs: Remove truncation of path alias
parent 947e0790
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@

namespace Drupal\path;

use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Entity\EntityStorageInterface;
@@ -168,13 +167,14 @@ public function buildRow(EntityInterface $entity) {

    $row['data']['alias']['data'] = [
      '#type' => 'link',
      '#title' => Unicode::truncate($alias, 50, FALSE, TRUE),
      '#url' => $url->setOption('attributes', ['title' => $alias]),
      '#title' => $alias,
      '#url' => $url,
    ];

    $row['data']['path']['data'] = [
      '#type' => 'link',
      '#title' => Unicode::truncate($path, 50, FALSE, TRUE),
      '#url' => $url->setOption('attributes', ['title' => $path]),
      '#title' => $path,
      '#url' => $url,
    ];

    if ($this->languageManager->isMultilingual()) {
+2 −6
Original line number Diff line number Diff line
@@ -174,14 +174,10 @@ public function testAdminAlias() {
    $edit['path[0][value]'] = '/node/' . $node1->id();
    $alias = '/' . $this->randomMachineName(128);
    $edit['alias[0][value]'] = $alias;
    // The alias is shortened to 50 characters counting the ellipsis.
    $truncated_alias = substr($alias, 0, 47);
    $this->drupalGet('admin/config/search/path/add');
    $this->submitForm($edit, 'Save');
    // The untruncated alias should not be found.
    $this->assertSession()->pageTextNotContains($alias);
    // The 'truncated' alias will always be found.
    $this->assertSession()->pageTextContains($truncated_alias);
    // The alias will always be found.
    $this->assertSession()->pageTextContains($alias);

    // Create third test node.
    $node3 = $this->drupalCreateNode();