allow to define templates show before and after a murph collection item

This commit is contained in:
Simon Vieille 2023-10-06 12:46:51 +02:00
parent 177b23365b
commit bd663838f6
Signed by: deblan
GPG key ID: 579388D585F70417
3 changed files with 15 additions and 0 deletions

View file

@ -1,5 +1,8 @@
## [Unreleased]
### Added
* allow to define templates show before and after a murph collection item
### Fixed
* fix regression on crud sorting
* remove parameter $option on CrudConfiguration::setForm and fix CrudController make template

View file

@ -22,6 +22,8 @@ class CollectionType extends BaseCollectionType
'label_delete' => $options['label_delete'],
'allow_add' => $options['allow_add'],
'allow_delete' => $options['allow_delete'],
'template_before_item' => $options['template_before_item'],
'template_after_item' => $options['template_after_item'],
]);
}
@ -33,6 +35,8 @@ class CollectionType extends BaseCollectionType
'collection_name' => '',
'label_add' => 'Add',
'label_delete' => 'Delete',
'template_before_item' => null,
'template_after_item' => null,
]);
}

View file

@ -116,10 +116,18 @@
<div data-collection="collection-{{ collection_name }}" {% for attr, value in row_attr %}{{ attr }}="{{ value }}"{% endfor %}>
{% for item in form %}
<div data-collection-item="{{ loop.index }}" {% for attr, value in attrs %}{{ attr }}="{{ value }}"{% endfor %}>
{% if template_before_item %}
{{ include(template_before_item) }}
{% endif %}
{% for child in item %}
{{ form_row(child) }}
{% endfor %}
{% if template_after_item %}
{{ include(template_after_item) }}
{% endif %}
{% if allow_delete %}
<div class="text-right">
<span data-collection-delete-container class="btn btn-sm btn-danger">