<?php
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

/** @var Zend_Form_Element $internalEmailElement */
$internalEmailElement = $this->form->getElement('internalEmail');
/** @var Zend_Form_Element $externalEmailElement */
$externalEmailElement = $this->form->getElement('externalEmail');

?>

<?php if ($internalEmailElement) { ?>
    <?php
    $domainElement = $this->form->getElement('domain');
    if ($domainElement) {
        $domainElementContent = ' @ ' . $this->elementPart($domainElement)->content();
    } else {
        $domainElementContent = " @<span id='{$internalEmailElement->getId()}-domain'>{$this->domainName}</span>";
    }
    ?>
    <div class="form-row">
        <div class='field-name'>
            <?= $this->elementPart($internalEmailElement)->label() ?>
        </div>
        <div class='field-value'>
            <div class='form-row<?= $internalEmailElement->hasErrors() ? ' error' : '' ?>'>
                <div><?= $this->elementPart($internalEmailElement)->content() . $domainElementContent ?></div>
                <span class='field-errors'<?= $internalEmailElement->hasErrors() ? '' : ' style="display:none;"' ?>>
                    <?= $this->elementPart($internalEmailElement)->errors() ?>
                </span>
                <?= $this->elementPart($internalEmailElement)->description() ?>
            </div>
        </div>
    </div>
<?php } ?>

<?= $externalEmailElement->render() ?>
