Skip to content

Commit

Permalink
Merge pull request #3509 from bolt/fix/limit-option-inconsistency
Browse files Browse the repository at this point in the history
Set limit per relation and select field option
  • Loading branch information
bobdenotter authored Dec 22, 2023
2 parents b7f7336 + a9f70c0 commit aff7016
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
5 changes: 3 additions & 2 deletions templates/_partials/fields/select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
21 changes: 11 additions & 10 deletions templates/content/_relationships.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

<div class="mb-4">
Expand All @@ -26,14 +27,14 @@

<div>
<editor-select
:value="{{ value }}"
:name="'relationship[{{ toContentTypeSlug }}]'"
:id="'relationship-{{ toContentTypeSlug }}'"
:options="{{ options }}"
:optionslimit="{{ limit }}"
:multiple="{{ relation.multiple ? 'true' : 'false' }}"
:taggable=false
:autocomplete=true
:value="{{ value }}"
:name="'relationship[{{ toContentTypeSlug }}]'"
:id="'relationship-{{ toContentTypeSlug }}'"
:options="{{ options }}"
:optionslimit="{{ limit }}"
:multiple="{{ relation.multiple ? 'true' : 'false' }}"
:taggable=false
:autocomplete=true
></editor-select>
</div>

Expand Down

0 comments on commit aff7016

Please sign in to comment.