Skip to content

Commit

Permalink
allow data-* form parameters to be used as <form> attributes. (#336)
Browse files Browse the repository at this point in the history
Contrary to the previous `form.data.blueprints.form` extraction model,
blueprints-expansion is not enabled.

Eg: `data-data-foo@: '\Grav\Plugin\Admin::route'` would *not* create
 a `data-foo='http://...'` attribute.
  • Loading branch information
Raphaël Droz authored Dec 1, 2020
1 parent 8b42f24 commit e4486d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions templates/forms/default/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
class="{{ parent() }} {{ override_form_classes|trim }}"
{%- endblock %}

{% block embed_form_custom_attributes %}
{% for k, v in blueprints.form.attributes %}
{{ k }}="{{ v|e }}"
{% endfor %}
{% endblock %}

{% block embed_fields %}
{{ override_inner_markup_fields_start|raw }}
{{ override_inner_markup_fields|raw }}
Expand Down
3 changes: 2 additions & 1 deletion templates/forms/layouts/form.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<form
{% block embed_form_core %}{% endblock %}
{% block embed_form_classes %}{% endblock %}
{% block embed_form_custom_attributes %}{% endblock %}
>
{% block embed_fields %}{% endblock %}
{% block embed_buttons %}{% endblock %}
</form>
</form>

0 comments on commit e4486d5

Please sign in to comment.