will "label" => "foo" still default to the label name? I dont want to
do label: {"name" => {"name": "Foo"}} everywhere :-)
Otherwise i think its a good addition.
On Mon, 20 Jun 2011 03:42:37 -0700 (PDT), victor berchet wrote:
Benfrid,
I am not sure to get your point, there is no magic at all, only a way
of forwarding some options when rendering a row.
This allow writing
{{ form_row(field, {"label": {label options}, "widget" : {widget
options}}) }}
Rather than having to exand this to customize the options:
{{ form_label(field, null, {label options}) }}
{{ form_errors(field) }}
{{ form_widget(field, {widget options}) }}
"label options" and "widget options" use the same syntax in the first
and second version.
You don't have to use the "label" nor "widget" options when rendering
a row. Use it only when you need to override the default label or to
add some attributes.
Jordi,
Your last idea introduces yet an other syntax while the "label
options" and "widget options" follow the current syntax (see the
example above).
This as been implemented in the commit:
https://github.com/vicb/symfony/commit/f729c6ba93397f918dc1b0661fca5f268782be53
of the PR:
https://github.com/symfony/symfony/pull/1369
Let me know you think about this.
Cheers,
Victor
On Jun 20, 11:18 am, Jordi Boggiano <j.boggi...@seld.be> wrote:
On 19.06.2011 20:30, victor berchet wrote:
> The thing is label already accepts "{ label: 'foo', attr:
{"label":
> "fallbackfoo", ...} }" and widget accepts "{ attr: {...} }" when
> rendering.
> And then we can use the "attr" as attributes of the the row (the
<div>
> tag) so it would be:
> render_row(form.field, {"label": {"label":"foo", "attr":
> {"class":"labelbla"}}, widget: {"attr": "widgetbla" }, "attr":
> {"class": "rowbla"}})
> LABEL: label.label would be use when provided, otherwise
> label.attr.label would be use if provided otherwise the default
label
> would be use.
> WIDGET: the widget value would be used as options when rendering
the
> widget,
> ROW: the attr would be used to render the container attributes on
the
> row.
> What do you think ?
I just think this is highly unreadable due to the nesting of objects
and
with their enforced quotes and such it's really verbose.
The way you put it gave me an idea though, but I'm not sure if it's
a
good one ;) We could actually namespace the property names, and
really use:
{"label.text": "foo", "label.attr": {"class":"bla"}, "widget.attr":
{"class":"bar"}
I think it makes it a bit more readable due to less nesting.
Cheers
--
Jordi Boggiano
@seldaek -http://nelm.io/jordi
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en