Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Admin Bundle Laravel Package

aropixel/admin-bundle

View on GitHub
Deep Wiki
Context7

Twig Macros Documentation

This documentation describes the reusable Twig macros provided by AropixelAdminBundle.

Actions Macro

The actions macro generates a dropdown button containing standard actions (like "Edit" and "Delete") for an item in a list or a table.

Location

File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/actions.html.twig

Usage

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) }}

Parameters

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.

Example

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 %}

Breadcrumb Macro

The breadcrumb macro generates a navigation breadcrumb list from an array of items.

Location

File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/breadcrumb.html.twig

Usage

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 %}

Parameters

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.

Image Macro

The image macro allows displaying an image thumbnail with a status icon (online/offline), commonly used in list views.

Location

File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/image.html.twig

Usage

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})) }}

Parameters

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.

Forms Macro

The forms macro contains helpers for form-related components, such as tabbed navigation.

Location

File: [@AropixelAdmin](https://github.com/AropixelAdmin)/Macro/forms.html.twig

Usage

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 %}

Parameters

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.

Adding New Macros

When adding new macros to the bundle:

  1. Create a new file in src/Resources/views/Macro/.
  2. Document the macro in this file following the same structure.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware