|
|
@ -4,6 +4,7 @@ namespace Drupal\twig_tweak; |
|
|
|
|
|
|
|
|
|
|
|
use Drupal\Component\Utility\NestedArray; |
|
|
|
use Drupal\Component\Utility\NestedArray; |
|
|
|
use Drupal\Component\Utility\Unicode; |
|
|
|
use Drupal\Component\Utility\Unicode; |
|
|
|
|
|
|
|
use Drupal\Component\Utility\UrlHelper; |
|
|
|
use Drupal\Component\Uuid\Uuid; |
|
|
|
use Drupal\Component\Uuid\Uuid; |
|
|
|
use Drupal\Core\Cache\CacheableMetadata; |
|
|
|
use Drupal\Core\Cache\CacheableMetadata; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
|
use Drupal\Core\Entity\EntityInterface; |
|
|
@ -353,6 +354,9 @@ class TwigTweakExtension extends AbstractExtension { |
|
|
|
$options['language'] = $language; |
|
|
|
$options['language'] = $language; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (UrlHelper::isExternal($user_input)) { |
|
|
|
|
|
|
|
return Url::fromUri($user_input, $options); |
|
|
|
|
|
|
|
} |
|
|
|
if (!in_array($user_input[0], ['/', '#', '?'])) { |
|
|
|
if (!in_array($user_input[0], ['/', '#', '?'])) { |
|
|
|
$user_input = '/' . $user_input; |
|
|
|
$user_input = '/' . $user_input; |
|
|
|
} |
|
|
|
} |
|
|
|