Support random default values for list child fields (#2255)

* Support default values for list child fields

* Update CHANGELOG.md

Co-authored-by: Djamil Legato <djamil+github@djamil.it>
This commit is contained in:
xaver
2022-03-18 23:59:13 +01:00
committed by GitHub
parent 953477c7f3
commit 4c0cb4d4e6
2 changed files with 10 additions and 0 deletions

View File

@@ -90,6 +90,10 @@
{% set child_value = val %}
{% else %}
{% set child_value = form ? form.value(child.name) : data.value(child.name) %}
{# Look for a default value for that field #}
{% if child_value is null and val[child_name|trim('.', 'left')] is defined %}
{% set child_value = val[child_name|trim('.', 'left')] %}
{% endif %}
{% endif %}
{% set field_templates = include_form_field(child.type, field_layout, default_layout) %}