Skip to content
Snippets Groups Projects
Commit 39da105a authored by Lily Yan's avatar Lily Yan
Browse files

Merge branch 'feature/ISTWCMS-4945-ebremner-fix-links' into '1.0.x'

ISTWCMS-4945: fixing links in node data

See merge request !124
parents 2fb6a1ec 87debcb7
No related branches found
No related tags found
1 merge request!124ISTWCMS-4945: fixing links in node data
......@@ -2,6 +2,7 @@
namespace Drupal\uw_cfg_common\Service;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
......@@ -492,7 +493,15 @@ class UWService implements UWServiceInterface {
// If there is data in the link, get the variables.
if ($link_data) {
$return_link_data['uri'] = $link_data[0]['uri'];
// Get correct uri, if external just use uri from node
// value, if not, then generate url from uri.
if (UrlHelper::isExternal($link_data[0]['uri'])) {
$return_link_data['uri'] = $link_data[0]['uri'];
}
else {
$return_link_data['uri'] = URL::fromUri($link_data[0]['uri'])->toString();
}
$return_link_data['title'] = $link_data[0]['title'];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment