From 91992ea10dffb7dd7d1e3a12feb423ed2da9e1e3 Mon Sep 17 00:00:00 2001 From: prashantdsala Date: Wed, 20 Dec 2023 17:35:30 +0530 Subject: [PATCH] Applied changes from the patch provided in #5 --- src/TwigTweakExtension.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TwigTweakExtension.php b/src/TwigTweakExtension.php index d007798..9473462 100644 --- a/src/TwigTweakExtension.php +++ b/src/TwigTweakExtension.php @@ -4,6 +4,7 @@ namespace Drupal\twig_tweak; use Drupal\Component\Utility\NestedArray; use Drupal\Component\Utility\Unicode; +use Drupal\Component\Utility\UrlHelper; use Drupal\Component\Uuid\Uuid; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Entity\EntityInterface; @@ -353,6 +354,9 @@ class TwigTweakExtension extends AbstractExtension { $options['language'] = $language; } } + if (UrlHelper::isExternal($user_input)) { + return Url::fromUri($user_input, $options); + } if (!in_array($user_input[0], ['/', '#', '?'])) { $user_input = '/' . $user_input; }