Skip to content

Commit c7491ea

Browse files
committed
2.0-upgrade twig fixes
1 parent 6ad7066 commit c7491ea

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<button type="button" class="btn btn-sm dropdown-toggle" data-bs-toggle="dropdown">
2-
<span class="text-black-50">{{ 'sylius.ui.show'|trans }}: </span>{{ hookable_metadata.context.products.maxPerPage }}
3-
</button>
2+
<span class="text-black-50">{{ 'sylius.ui.show'|trans }}: </span>
3+
{{ hookable_metadata.context.products is defined and hookable_metadata.context.products is not empty and hookable_metadata.context.products.maxPerPage is defined ? hookable_metadata.context.products.maxPerPage : 'N/A' }}
4+
</button>
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{% set products = hookable_metadata.context.products %}
1+
{% set products = hookable_metadata.context.products is defined and hookable_metadata.context.products is not empty ? hookable_metadata.context.products : null %}
22
{% import '@SyliusShop/shared/pagination/pagination.html.twig' as pagination %}
33

4-
{{ pagination.simple(products) }}
4+
{% if products is not null %}
5+
{{ pagination.simple(products) }}
6+
{% endif %}

templates/Shop/SiteWideSearch/content/body/main/products.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% import '@SyliusShop/shared/messages.html.twig' as messages %}
22

3-
{% set products = hookable_metadata.context.products %}
3+
{% set products = hookable_metadata.context.products is defined and hookable_metadata.context.products is not empty ? hookable_metadata.context.products : [] %}
44

55
{% if products|length > 0 %}
66
<div class="products-grid" {{ sylius_test_html_attribute('products') }}>

templates/Shop/SiteWideSearch/content/body/main/sorting.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% if hookable_metadata.context.products.nbResults > 0 %}
1+
{% if hookable_metadata.context.products is defined and hookable_metadata.context.products is not empty and hookable_metadata.context.products.nbResults is defined and hookable_metadata.context.products.nbResults > 0 %}
22

33
{% set route = app.request.attributes.get('_route') %}
44
{% set route_parameters = app.request.query.all|unset_elements(['order_by', 'sort', 'page']) %}

0 commit comments

Comments
 (0)