<?php
// Copyright 1999-2025. WebPros International GmbH. All rights reserved.
?>
<?php echo $this->render('partials/forms/radio-controls.phtml'); ?>
<?php if ($this->element->disable !== true): ?>
    <script type="text/javascript">
    //<![CDATA[
    (() => {
        const redirectToWww = document.querySelector('label[for="<?php echo $this->element->getId() . '-' . PhDomain::SEO_REDIRECT_TO_WWW; ?>"]');
        const redirectToLanding = document.querySelector('label[for="<?php echo $this->element->getId() . '-' . PhDomain::SEO_REDIRECT_TO_LANDING; ?>"]');

        const generateSeoRedirectOptions = e => {
            const domainName = Jsw.escapeHtml(e.detail || '<your_domain>');
            redirectToWww.innerHTML = 'www.' + domainName;
            redirectToLanding.innerHTML = domainName;
        };

        redirectToWww.closest('form').addEventListener('domainNameChange', generateSeoRedirectOptions);
    })();
    //]]>
    </script>
<?php endif; ?>
