Skip to content

Commit

Permalink
Fixed fieldset field not allowing to properly save when contained wit…
Browse files Browse the repository at this point in the history
…hin a list (fixes #1225)
  • Loading branch information
w00fz committed Sep 26, 2017
1 parent 0378738 commit eb1f1ca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
1. [](#bugfix)
* Fix editor not clickable in list field [#1224](https://github.com/getgrav/grav-plugin-admin/pull/1124)
* Updated Google Font URLs to always connect over HTTPS. [#1106](https://github.com/getgrav/grav-plugin-admin/pull/1106)
* Fixed fieldset field not allowing to properly save when contained within a list [#1225](https://github.com/getgrav/grav-plugin-admin/issues/1225)

# v1.6.0
## 09/07/2017
Expand Down
34 changes: 23 additions & 11 deletions themes/grav/templates/forms/fields/fieldset/fieldset.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@
{% endblock %}#}
>

{% block group %}
{% block group %}
{% if field.text %}
<p>{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu }}{% else %}{{ field.text|t }}{% endif %}<p>
{% endif %}
<p>{% if grav.twig.twig.filters['tu'] is defined %}{{ field.text|tu }}{% else %}{{ field.text|t }}{% endif %}
<p>
{% endif %}

{% if field.fields %}
{% for field in field.fields %}
{% if field.type %}
{% set value = field.name ? data.value(field.name) : data.toArray %}
{% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %}
{% if field.fields %}
{%- for childName, child in field.fields -%}
{%- if childName starts with '.' -%}
{%- set childKey = childName|trim('.') -%}
{%- set childName = itemName ~ childName -%}
{%- else %}
{%- set childKey = childName -%}
{%- set childName = childName|replace({'*': key}) -%}
{%- endif %}
{%- set child = child|merge({ name: childName }) -%}

{% if field.type %}
{%- include [
"forms/fields/#{child.type}/#{child.type}.html.twig",
'forms/fields/text/text.html.twig'
] with { field: child, value: data.value(child.name) } -%}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endblock %}
{% endblock %}
</div>
{% endblock %}
</div>
Expand Down

0 comments on commit eb1f1ca

Please sign in to comment.