Skip to content

Commit 1128fb4

Browse files
committed
feature #6720 Allow customize entity row attributes on index page (zorn-v)
This PR was merged into the 4.x branch. Discussion ---------- Allow customize entity row attributes on index page In my project I need to highlight entity rows with different colors based on entity status. Currently I need to copy all `table_body` just for add css class to row like `class="status-row status-row-{{ entity.instance.status.name|lower }}"` With this patch I just need to add this in overrided template ```twig {% block entity_row_attributes %} class="status-row status-row-{{ entity.instance.status.name|lower }}" {% endblock %} ``` PS. After updating from 4.13, currently I need to update all my custom templates with this logic as `table_body` was changed. Commits ------- ad6fd11 Allow customize entity row attributes on index page
2 parents 76a23ec + ad6fd11 commit 1128fb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/crud/index.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
{% block table_body %}
140140
{% for entity in entities %}
141141
{% if entity.isAccessible %}
142-
<tr data-id="{{ entity.primaryKeyValueAsString }}">
142+
<tr data-id="{{ entity.primaryKeyValueAsString }}" {% block entity_row_attributes %}{% endblock %}>
143143
{% if has_batch_actions %}
144144
<td class="batch-actions-selector">
145145
<div class="form-check">

0 commit comments

Comments
 (0)