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

// @codingStandardsIgnoreFile

/** @var \Magento\Customer\Block\Widget\Gender $block */
?>
<div class="field gender<?php if ($block->isRequired()) echo ' required' ?>">
    <label class="label" for="<?= $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr($block->getFieldId('gender')) ?>"><span><?= $block->escapeHtml(__('Gender')) ?></span></label>
    <div class="control">
        <select id="<?= $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr($block->getFieldId('gender')) ?>" name="<?= $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr($block->getFieldName('gender')) ?>" title="<?= $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr(__('Gender')) ?>"<?php if ($block->isRequired()):?> class="validate-select" data-validate="{required:true}"<?php endif; ?>>
            <?php $options = $block->getGenderOptions(); ?>
            <?php $value = $block->getGender();?>
            <?php foreach ($options as $option):?>
                <option value="<?= $this->helper(\Magento\Framework\EscapeHelper::class)->escapeHtmlAttr($option->getValue()) ?>"<?php if ($option->getValue() == $value) echo ' selected="selected"' ?>><?= $block->escapeHtml(__($option->getLabel())) ?></option>
            <?php endforeach;?>
        </select>
    </div>
</div>
