<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
?>
<?php $scriptString = <<<script

require([
    'jquery',
    'mage/template',
], function($, mageTemplate){

setSettings = function(urlTemplate, codeElement, themeElement) {
    var url;

    if (!$('#edit_form').valid()) {
        return false;
    }

    url = mageTemplate(urlTemplate, {
        data: {
            'code': $('#' + codeElement).val(),
            'theme_id': $('#' + themeElement).val()
        }
    });

    setLocation(url);
};
});

script;
?>
<?= /* @noEscape */ $secureRenderer->renderTag('script', [], $scriptString, false) ?>
