getgrav / grav-plugin-form

Grav Form Plugin
http://getgrav.org
MIT License
53 stars 79 forks source link

checkbox field misses append and prepend #565

Open drzraf opened 2 years ago

drzraf commented 2 years ago

As per https://learn.getgrav.org/17/admin-panel/extending#adding-a-custom-field, using prepend or append block. But the checkbox field (and maybe others) overrides the whole input block without providing the same extension sub-blocks (namely prepend or append)

A somehow related problem is that create such an override (at <theme/templates/forms/fields/checkbox/checkbox.html.twig) simply containing:

{% extends "forms/fields/checkbox/checkbox.html.twig" %}

{% block label %}
foo
{% endblock %}

... basically kills PHP (probably triggering an infinite loop). Not only no error message is logged in such situation but the advise (suggested in the above-mentioned documentation) to only extends forms/field.html.twig instead of a specific field's template, forces to copy/paste a lot of boiler-plate code what is clearly suboptimal.