{% extends '@nucleus/partials/particle.html.twig' %}

{% set attr_extra = '' %}
{% if particle.extra %}
    {% for attributes in particle.extra %}
        {% for key, value in attributes %}
            {% set attr_extra = attr_extra ~ ' ' ~ key|e ~ '="' ~ value|e('html_attr') ~ '"' %}
        {% endfor %}
    {% endfor %}
{% endif %}

{% set particleheading %}
	<div class="g-particle-intro">
		{% if particle.mainheading %}
			<h3 class="g-title g-main-title">{{ particle.mainheading|raw }}</h3>
			<div class="g-title-separator {% if particle.introtext == false %}no-intro-text{% endif %}"></div>
		{% endif %}	
		{% if particle.introtext %}<p class="g-introtext">{{ particle.introtext|raw }}</p>{% endif %}
	</div>
{% endset %}

{% block particle %}
	<div class="g-paypaldonate{% if particle.css.class %} {{ particle.css.class|e }}{% endif %}" {% if particle.extra %}{{ attr_extra|raw }}{% endif %}>
		{% if particle.mainheading or particle.introtext %}
			{{ particleheading }}
		{% endif %}

		<div class="g-paypaldonate-form">
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="{{ particle.target|default('_blank')|e }}">
				<input type="hidden" name="business" value="{{ particle.email|e }}" />
				<input type="hidden" name="cmd" value="_donations">
			
				<input type="hidden" name="item_name" value="{{ particle.itemname|e }}">
				<input type="hidden" name="item_number" value="{{ particle.itemnumber|e }}">
				<input type="hidden" name="currency_code" value="{{ particle.currencycode|e }}">
			
				<div class="g-paypaldonate-button button">
					{% if particle.buttonicon %}
						<i class="g-paypaldonate-icon {{ particle.buttonicon|e }}"></i>
					{% endif %}
					<input type="submit" alt="Donate" name="submit" value="{{ particle.buttontext|e }}">
				</div>
			</form>
		</div>
	</div>
{% endblock %}