-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow passing arbitrary form attributes #336
Conversation
ping |
be495ef
to
d83422d
Compare
rebased... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions above.
@drzraf We were talking about the forms today, and it looks like there's already an implementation for this for form fields, which is different to your implementation. I think it would be great if both the form and the fields used the same way instead of needing very different input from each other. This is the code for a form field: PS: There is also support for custom attributes, but it uses yet another approach: |
In order to move on, which implementation you advise? |
@rhukster We need to decide how to define attributes throughout Grav. I kind of like {% if field.attributes is defined %}
{% for attribute in field.attributes %}
{{ attribute.name }}="{{ attribute.value|e }}"
{% endfor %}
{% endif %} |
b3cf2ea
to
2807d09
Compare
Please see latest version:
I'd be happy if you could help getting the best of both approaches. |
IMHO data-*@ should work everywhere, so you can put it under attributes. |
I strongly share that wish, but I simply failed to find a way to do it. |
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.
2807d09
to
8736f0b
Compare
@rhukster : I'm really happy this got merged. |
@drzraf From my understanding It is documented here: I think the function must return a named array (dict) so we have This new feature should be documented here: |
@drzraf did that work? |
Sadly no. Not with the merged commit,
|
Form support for
data-*
orconfig-data-*@
parameters to be used as<form>
attributesSee #173 and #293 and #294