seacms-theme/includes/blocks/_actions.twig
2023-03-17 01:03:13 +01:00

68 lines
3.0 KiB
Twig

{# SPDX-License-Identifier: EUPL-1.2 #}
{% if mode == "portfolio" and (not (include_close_button is defined) or (include_close_button is same as(true))) %}
{% set actions = (actions ? actions : [])|merge([{
"icon": "times",
"content": "Close Window",
"color": "primary",
"outline": false,
"close_button": true}]) %}
{% endif %}
{% if actions %}
<div class="text-center mt-4">
{% block actionscontent %}
{% for action in actions %}
{% if action.close_button %}
<button data-bs-dismiss="modal"
{% block attributes %}
class="btn {{
(mode == "social")
? 'btn-social mx-1'
: 'mx-1 my-1'
}}
{%- if mode != "social" and not action.close_button and action.size != "medium"
%} {% if action.size in ["small", "large", "xlarge"] -%}
{{- action.size|replace({"small": "btn-sm", "large": "btn-lg", "xlarge": "btn-xl"}) -}}
{% else %}btn-xl
{%- endif -%}
{%- endif %} btn-{{
(
action.outline is same as(true) or
mode in ["about", "social"]
) ? 'outline-' }}{{
(action.color in ["primary", "secondary", "success", "danger", "warning", "info", "light", "dark"])
? action.color
: (
(mode in ["about", "social"])
? 'light'
: 'primary'
)
}}{% if action.disabled %} disabled{% endif %}
{%- if action.close_button %} d-block mx-auto mt-4{% endif %}"
{% if action.link and not action.disabled %} href="{{ action.link|url }}" {% endif %}
{% endblock attributes %}
>
{% block contentlink %}
{% if action.icon %}
<i class="{{ [(action.brands ? 'fab' : 'fas'), 'fa-fw', ('fa-' ~ action.icon), (mode != 'social' ? 'me-2')]|join(' ')}}"></i>
{% endif %}
{{ mode != "social" ? action.content }}
{% endblock contentlink %}
</button>
{% else %}
<a {{ block('attributes') }}>
{{ block('contentlink') }}
</a>
{% endif %}
{% endfor %}
{% endblock actionscontent %}
</div>
{% else %}
{{ block('actionscontent') }}
{% endif %}