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

/** @var Subscribe $block */

use Magento\Newsletter\Block\Subscribe;

if (!$block->getButtonLockManager() && class_exists(\Magento\Framework\View\Element\ButtonLockManager::class)) {
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    $block->setButtonLockManager(
        $objectManager->get(\Magento\Framework\View\Element\ButtonLockManager::class)
    );
}
/** @var $escaper \Magento\Framework\Escaper */
$at_settings          = $this->helper('Olegnax\Athlete2\Helper\Helper')->getConfig('athlete2_settings/footer');
$newsletterStyle      = $at_settings['newsletter_style'];
$newsletterInputStyle = $at_settings['newsletter_input_underlined'];
$newsletterTitle      = $at_settings['newsletter_title']; //__('Newsletter Sign Up')
$newsletterLabel      = $at_settings['newsletter_label']; //__('Get the latest deals and more')
$newsletterLabelAria  = $newsletterLabel ? $newsletterLabel : $newsletterTitle;
if ($newsletterInputStyle) {
    $newsletterInputStyle = 'inputs-style--underlined';
} else {
    $newsletterInputStyle = '';
}
?>
<div class="block newsletter newsletter-style--<?= $newsletterStyle ?> <?= $newsletterInputStyle ?>">
	<div class="block_newsletter_info">
		<?php if ($newsletterTitle) {
    ?>
			<div class="title"><?= $newsletterTitle ?></div> <?php
} ?>
		<?php if ($newsletterLabel) {
        ?><label class="label">
			<span><?= $escaper->escapeHtml($newsletterLabel) ?></span></label> <?php
    } ?>
	</div>
	<div class="content">
		<form class="form subscribe"
			  novalidate
			  action="<?= $escaper->escapeUrl($block->getFormActionUrl()) ?>"
			  method="post"
			  data-mage-init='{"validation": {"errorClass": "mage-error"}}'
			  id="newsletter-validate-detail">
			<div class="field newsletter">
				<div class="control">
					<label for="newsletter">
						<span class="label">
							<?= $escaper->escapeHtml($newsletterLabelAria) ?>
						</span>
					</label>
					<input name="email" type="email" id="newsletter"
						   placeholder="<?= $escaper->escapeHtml(__('Enter your email address')) ?>"
						   data-validate="{required:true, 'validate-email':true}"
					/>
				</div>
			</div>
			<div class="actions">
				<button class="action subscribe primary"
						title="<?= $escaper->escapeHtmlAttr(__('Subscribe')) ?>"
						type="submit"
						aria-label="Subscribe"
						<?php if (method_exists($block, 'getButtonLockManager') && $block->getButtonLockManager()->isDisabled('newsletter_form_submit')): ?>
                        disabled="disabled"
                    <?php endif; ?>>
					<span><?= $escaper->escapeHtml(__('Subscribe')) ?></span>
				</button>
			</div>
		</form>
	</div>
</div>
