From a9f70c01540e020c5024f1b562816b698d40dc3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9stor=20de=20Dios=20Fern=C3=A1ndez?= Date: Wed, 13 Dec 2023 13:57:25 +0100 Subject: [PATCH] Set limit per relation and select field option --- templates/_partials/fields/select.html.twig | 5 +++-- templates/content/_relationships.html.twig | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/templates/_partials/fields/select.html.twig b/templates/_partials/fields/select.html.twig index 9a7957b8d..52cf49fb9 100644 --- a/templates/_partials/fields/select.html.twig +++ b/templates/_partials/fields/select.html.twig @@ -33,8 +33,9 @@ {% set autocomplete = field.definition.get('autocomplete')|default ? 'true' : 'false' %} {% endif %} -{% if limit is not defined %} - {% set limit = field.definition.get('limit')|default(2000) %} +{% set limit = config.get('general/maximum_listing_select', 2000) %} +{% if field.definition.get('limit') is defined and field.definition.get('limit') is not empty %} + {% set limit = field.definition.get('limit') %} {% endif %} {% block field %} diff --git a/templates/content/_relationships.html.twig b/templates/content/_relationships.html.twig index 66b1a397e..9379d5b6e 100644 --- a/templates/content/_relationships.html.twig +++ b/templates/content/_relationships.html.twig @@ -6,9 +6,10 @@ {% set options = related_options(fromContentType, toContentTypeSlug, relation.order|default(), relation.format|default(), relation.required, relation.allow_empty, relation.link_to_record|default(false), ) %} {% set value = record|related_values(toContentTypeSlug) %} + {% set limit = config.get('general/maximum_listing_select', 2000) %} - {% if limit is not defined %} - {% set limit = relation.get('limit')|default(2000) %} + {% if relation.get('limit') is defined and relation.get('limit') is not empty %} + {% set limit = relation.get('limit') %} {% endif %}
@@ -26,14 +27,14 @@