Skip to content

Commit 904ba43

Browse files
committed
fix(bootstrap-admin-ui): Fix data table when using a resource without id
1 parent 6e69a60 commit 904ba43

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/BootstrapAdminUi/templates/shared/crud/index/content/grid/data_table.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% import '@SyliusBootstrapAdminUi/shared/helper/table.html.twig' as table %}
22
{% import '@SyliusBootstrapAdminUi/shared/helper/pagination.html.twig' as pagination %}
33

4-
{% set resources = hookable_metadata.context.resources %}
4+
{% set resources = resources|default(hookable_metadata.context.resources|default(null)) %}
55
{% set data = resources.data|default([]) %}
66
{% set definition = resources.definition|default(null) %}
77

src/BootstrapAdminUi/templates/shared/helper/table.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
{% macro row(grid, definition, row) %}
2525
{% import '@SyliusBootstrapAdminUi/shared/helper/dropdown.html.twig' as dropdown %}
2626

27-
<tr class="item" {{ sylius_test_html_attribute('row') }} {{ sylius_test_html_attribute('resource-id', row.id) }}>
28-
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
27+
<tr class="item" {{ sylius_test_html_attribute('row') }} {{ sylius_test_html_attribute('resource-id', row.id|default(null)) }}>
28+
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 and row.id is defined %}
2929
<td class="text-center"><input data-check-all-group="index" class="form-check-input" type="checkbox" value="{{ row.id }}" /></td>
3030
{% endif %}
3131
{% for field in definition.enabledFields|sylius_sort_by('position') %}

0 commit comments

Comments
 (0)