<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<?php
/* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */
$element = $block->getElement();
$note = $element->getNote() ? '<div class="note">' . $element->getNote() . '</div>' : '';
$elementBeforeLabel = $element->getExtType() == 'checkbox' || $element->getExtType() == 'radio';
$addOn = $element->getBeforeElementHtml() || $element->getAfterElementHtml();
$fieldId = ($element->getHtmlContainerId()) ? ' id="' . $element->getHtmlContainerId() . '"' : '';
$fieldClass = "admin__field field field-{$element->getId()} {$element->getCssClass()}";
$fieldClass .= ($elementBeforeLabel) ? ' choice' : '';
$fieldClass .= ($addOn) ? ' with-addon' : '';
$fieldClass .= ($element->getRequired()) ? ' _required' : '';
$fieldClass .= ($note) ? ' with-note' : '';

$fieldAttributes = $fieldId . ' class="' . $fieldClass . '" '
    . $block->getUiId('form-field', $element->getId());
?>

<?php if (!$element->getNoDisplay()): ?>
    <?php if ($element->getType() == 'hidden'): ?>
        <?= $element->getElementHtml() ?>
    <?php else: ?>
    <div <?= /* @noEscape */ $fieldAttributes ?>>
        <?php if ($elementBeforeLabel): ?>
            <?= $element->getElementHtml() ?>
            <?= $element->getLabelHtml('', $element->getScopeLabel()) ?>
            <?= /* @noEscape */ $note ?>
        <?php else: ?>
            <?= $element->getLabelHtml('', $element->getScopeLabel()) ?>
            <div class="admin__field-control control">
                <?php if ($addOn): ?>
                <div class="addon">
                <?php endif; ?>
                    <?= /* @noEscape */ $element->getElementHtml() ?>
                <?php if ($addOn): ?>
                </div>
                <?php endif; ?>
                <?= $block->getHintHtml() ?>
                <?= /* @noEscape */ $note ?>
            </div>
        <?php endif; ?>
    </div>
    <?php endif; ?>
<?php endif; ?>
