This documentation describes the reusable Twig macros provided by AropixelAdminBundle.
The actions macro generates a dropdown button containing standard actions (like "Edit" and "Delete") for an item in a list or a table.
File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/actions.html.twig
To use this macro, you first need to import it in your Twig template:
{% import '[@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/actions.html.twig' as list %}
{# ... #}
{{ list.actions(item, edit_path, delete_path, delete_confirm_msg) }}
| Parameter | Type | Description |
|---|---|---|
item |
object |
The entity instance (used to generate the CSRF token for deletion). |
edit_path |
string |
(Optional) The URL for the "Edit" action. If omitted, the edit link will not be displayed. |
delete_path |
string |
(Optional) The URL for the "Delete" action. If omitted, the delete link will not be displayed. |
delete_confirm_msg |
string |
(Optional) A custom confirmation message for the deletion. Defaults to the translation of text.confirm_delete. |
In a DataTable row:
{% block datatable_body %}
<td>{{ item.id }}</td>
<td>{{ item.title }}</td>
<td class="text-right">
{{ list.actions(
item,
path('admin_event_edit', {id: item.id}),
path('admin_event_delete', {id: item.id})
) }}
</td>
{% endblock %}
The breadcrumb macro generates a navigation breadcrumb list from an array of items.
File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/breadcrumb.html.twig
To use this macro, you first need to import it in your Twig template:
{% import '[@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/breadcrumb.html.twig' as nav %}
{# ... #}
{% block header_breadcrumb %}
{{ nav.breadcrumbs([
{ label: 'text.home', url: url('_admin') },
{ label: 'Programmation' },
{ label: 'Modifier un artiste' }
]) }}
{% endblock %}
| Parameter | Type | Description |
|---|---|---|
items |
array |
An array of objects/associative arrays. Each item should have a label and an optional url. |
Each item in the items array can have:
label: (Required) The text to display (it will be passed through the |trans filter).url: (Optional) The URL for the link. If omitted, the label will be displayed without a link.The macro automatically adds the active class to the last item in the list.
The image macro allows displaying an image thumbnail with a status icon (online/offline), commonly used in list views.
File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/image.html.twig
To use this macro, you first need to import it in your Twig template:
{% import '[@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/image.html.twig' as media %}
{# ... #}
{{ media.thumbnail_with_status(item, 'image', 'status', path('admin_pack_edit', {'id': item.id})) }}
| Parameter | Type | Description |
|---|---|---|
item |
object |
The entity instance containing the image and status. |
image_field |
string |
(Optional) The name of the image property. Defaults to 'image'. |
status_field |
string |
(Optional) The name of the status property. Defaults to 'status'. |
edit_path |
string |
(Optional) The URL for the link around the thumbnail. |
filter |
string |
(Optional) The LiipImagine filter to apply. Defaults to 'admin_thumbnail'. |
height |
int |
(Optional) The height of the image in pixels. Defaults to 60. |
The forms macro contains helpers for form-related components, such as tabbed navigation.
File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/forms.html.twig
To use this macro, you first need to import it in your Twig template:
{% import '[@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/forms.html.twig' as forms %}
{# ... #}
{% block tabbable %}
{{ forms.tabs([
{ id: 'panel-tab-artist', label: 'Artiste' },
{ id: 'panel-tab-badge', label: 'Badge' },
{ id: 'panel-tab-prog', label: 'Programmation' }
]) }}
{% endblock %}
| Parameter | Type | Description |
|---|---|---|
items |
array |
An array of objects/associative arrays. Each item should have an id and a label. |
Each item in the items array can have:
id: (Required) The ID of the target tab-pane (without the # prefix).label: (Required) The text to display on the tab (it will be passed through the |trans filter).The macro automatically adds the active class to the first tab in the list.
When adding new macros to the bundle:
src/Resources/views/Macro/.How can I help you explore Laravel packages today?