diff --git a/library/Controller/BaseController.php b/library/Controller/BaseController.php index d908f6a93..0b6d4b7b0 100644 --- a/library/Controller/BaseController.php +++ b/library/Controller/BaseController.php @@ -304,6 +304,20 @@ public function __construct() return (object) array_merge((array) $obj, $lang); }, 10, 1); + if (!empty($_SERVER['HTTP_HOST'])) { + add_filter("ComponentLibrary/Component/Attribute", function ($attributes) { + if (!empty($attributes['href'])) { + $parsedUrl = parse_url($attributes['href']); + + if (!empty($parsedUrl['host']) && $parsedUrl['host'] !== $_SERVER['HTTP_HOST']) { + $attributes['data-js-original-link'] = $attributes['href']; + } + } + + return $attributes; + }, 10, 1); + } + //Wordpress hooks $this->data['hook'] = (object) array(