From 8209dda86ce18083024a1ddd4dbeb4dd87753de2 Mon Sep 17 00:00:00 2001
From: Igor Biki <ibiki@uwaterloo.ca>
Date: Wed, 15 Jan 2025 13:27:55 -0500
Subject: [PATCH] ISTWCMS-6306: Removing internal: substring from any links on
 display and form.

---
 src/Plugin/Block/UwCblLinks.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Plugin/Block/UwCblLinks.php b/src/Plugin/Block/UwCblLinks.php
index f41106c1..b03a9206 100644
--- a/src/Plugin/Block/UwCblLinks.php
+++ b/src/Plugin/Block/UwCblLinks.php
@@ -262,6 +262,7 @@ class UwCblLinks extends BlockBase implements ContainerFactoryPluginInterface {
 
             // Get the friendly path. Anything that doesn't have
             // one will return the "real" path.
+            $value = str_replace("internal:", "", $value);
             $pathauto = $this->pathAliasManager
               ->getAliasByPath($value);
 
@@ -455,8 +456,10 @@ class UwCblLinks extends BlockBase implements ContainerFactoryPluginInterface {
       // If there is a link already set, setup the details to
       // have the link in the title so when it is closed,
       // we can see what the actual is.
+      $value_uri = str_replace("internal:", "", $links['items'][$i]['uri'] ?? '');
+
       if (isset($links['items'][$i]['uri'])) {
-        $link = $this->t('Link (@uri)', ['@uri' => $links['items'][$i]['uri']]);
+        $link = $this->t('Link (@uri)', ['@uri' => $value_uri]);
       }
       else {
         $link = $this->t('Link');
@@ -480,7 +483,7 @@ class UwCblLinks extends BlockBase implements ContainerFactoryPluginInterface {
         '#autocomplete_route_parameters' => [
           'linkit_profile_id' => 'default',
         ],
-        '#default_value' => $links['items'][$i]['uri'] ?? '',
+        '#default_value' => $value_uri,
         '#required' => FALSE,
       ];
 
-- 
GitLab