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

// @codingStandardsIgnoreFile

?>
<?php
/* @var $block \Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element */
$element = $block->getElement();
$note = $element->getNote() ? '<div class="note admin__field-note" id="' . $element->getId() . '-note">' . $element->getNote() . '</div>' : '';
$elementBeforeLabel = $element->getExtType() == 'checkbox admin__control-checkbox' || $element->getExtType() == 'radio admin__control-radio';
$addOn = ($element->getBeforeElementHtml() || $element->getAfterElementHtml()) && !$element->getNoWrapAsAddon();
$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 _required' : '';
$fieldClass .= ($note) ? ' with-note' : '';
$fieldClass .= (!$element->getLabelHtml()) ? ' no-label' : '';

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

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