{% block page_account_overview_newsletter_content_inner %}
{% if feature('FEATURE_NEXT_14001') %}
{# @deprecated tag:v6.5.0 - variables success, messages and customer will be removed and found as properties of newsletterAccountPagelet #}
{% set success = newsletterAccountPagelet.success %}
{% set messages = newsletterAccountPagelet.messages %}
{% set customer = newsletterAccountPagelet.customer %}
{% endif %}
{% block page_account_overview_newsletter_content_success %}
{% if feature('FEATURE_NEXT_14001') %}
{% if newsletterAccountPagelet.messages|length > 0 %}
<div class="newsletter-alerts">
{% for message in newsletterAccountPagelet.messages %}
{% sw_include "@Storefront/storefront/utilities/alert.html.twig" with { 'type': message.type, 'content': message.text} %}
{% endfor %}
</div>
{% endif %}
{% else %}
{% if success is not null %}
<div class="newsletter-alerts">
{% for message in messages %}
{% sw_include "@Storefront/storefront/utilities/alert.html.twig" with { 'type': message.type, 'content': message.text} %}
{% endfor %}
</div>
{% endif %}
{% endif %}
{% endblock %}
{% set formAutoSubmitOptions = {
useAjax: true,
ajaxContainerSelector: '.js-newsletter-wrapper'
} %}
{% block page_account_overview_newsletter_content_form %}
<form name="newsletterRegister"
method="post"
action="{{ path("frontend.account.newsletter") }}"
data-form-auto-submit="true"
data-form-auto-submit-options='{{ formAutoSubmitOptions|json_encode }}'>
{# @deprecated tag:v6.5.0 - Block page_account_overview_newsletter_content_form_csrf will be removed. #}
{% block page_account_overview_newsletter_content_form_csrf %}
{{ sw_csrf('frontend.account.newsletter') }}
{% endblock %}
{% block page_account_overview_newsletter_content_form_check_control %}
<div class="{{ formCheckboxWrapperClass }}">
{% block page_account_overview_newsletter_content_form_input %}
{% set subscribe = constant('Shopware\\Core\\Content\\Newsletter\\SalesChannel\\NewsletterSubscribeRoute::OPTION_SUBSCRIBE') %}
{% set direct = constant('Shopware\\Core\\Content\\Newsletter\\SalesChannel\\NewsletterSubscribeRoute::OPTION_DIRECT') %}
{% set statusDirect = constant('Shopware\\Core\\Content\\Newsletter\\SalesChannel\\NewsletterSubscribeRoute::STATUS_DIRECT') %}
{% set statusOptIn = constant('Shopware\\Core\\Content\\Newsletter\\SalesChannel\\NewsletterSubscribeRoute::STATUS_OPT_IN') %}
{% set statusNotSet = constant('Shopware\\Core\\Content\\Newsletter\\SalesChannel\\NewsletterSubscribeRoute::STATUS_NOT_SET') %}
{% set status = false %}
{% if newsletterAccountPagelet.newsletterStatus == statusDirect or newsletterAccountPagelet.newsletterStatus == statusOptIn or newsletterAccountPagelet.newsletterStatus == statusNotSet %}
{% set status = true %}
{% endif %}
{% if feature('FEATURE_NEXT_14001') == false %}
{% set status = customer.newsletter %}
{% endif %}
<input type="checkbox"
class="{{ formCheckInputClass }}"
id="newsletterRegister"
name="option"
autocomplete="off"
value="subscribe"
{% if status %}checked="checked"{% endif %}>
{% endblock %}
{% block page_account_overview_newsletter_content_form_label %}
<label class="{{ formCheckLabelClass }} custom-control-label"
for="newsletterRegister">
{{ "account.newsletterSettings"|trans({'%shopname%': config('core.basicInformation.shopName')})|sw_sanitize }}
</label>
{% endblock %}
</div>
{% endblock %}
</form>
{% endblock %}
{% endblock %}