<?php
$siteMapTypes = $block->getSitemapTypes();
$sitemapType = $block->getSitemapType();
?>

<div class="admin__field field field-sitemap_type  _required" style="display:none">
    <label class="label admin__field-label" for="sitemap_type"><span><?=
     /*@noEscape*/ __("Sitemap Type"); ?></span></label>
    <div class="admin__field-control control">
        <select id="sitemap_type" name="sitemap_type" title="sitemap type" 
        class=" required-entry _required select admin__control-select">
            <?php
            foreach ($siteMapTypes as $value => $label) {
                ?>
                        <option 
                        <?php if ($sitemapType && $sitemapType == $value) { echo "selected "; } ?>
                            value="<?= $block->escapeHtml($value) ?>"
                        >
                        <?= $block->escapeHtml($label); ?>
                        </option>
                    <?php
            }
            ?>
        </select>
    </div>
</div>

<script>
    require(
        ['jquery'],
        function($) {
            var sitemapField = $(".field-sitemap_type");
            $(".field-sitemap_type").remove();

            $("#add_sitemap_form").append(sitemapField);
            $(".field-sitemap_type").show();
        }
    );
</script>

