-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathItem.html.twig
More file actions
28 lines (27 loc) · 1.14 KB
/
Item.html.twig
File metadata and controls
28 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{% props
label = null,
renderLabelRaw = false,
icon = null,
url = null,
htmlAttributes = {},
type = "a",
name = ""
%}
<li>
{% if type == "form" %}
{%- set form_id = 'form-' ~ name ~ '-' ~ random() -%}
<form action="{{ url }}" method="POST" id="{{ form_id }}" class="dropdown-item">
<button {{ attributes.defaults({class: 'action-button', href: url, form: form_id}|merge(htmlAttributes)) }}>
<span class="btn-label">
{%- if icon %}<twig:ea:Icon name="{{ icon }}"/> {% endif -%}
{%- if label is not empty -%}<span class="action-label">{{ renderLabelRaw ? label|trans|raw : label|trans }}</span>{%- endif -%}
</span>
</button>
</form>
{% else %}
<a {{ attributes.defaults({class: 'dropdown-item', href: url}|merge(htmlAttributes)) }}>
{%- if icon %}<twig:ea:Icon {{ ...attributes.nested('icon').defaults({name: icon}) }} /> {% endif -%}
{%- if label is not empty -%}<span {{ attributes.nested('label') }}>{{ renderLabelRaw ? label|raw : label }}</span>{%- endif -%}
</a>
{% endif %}
</li>