Stof:

If i understand correctly, you are in favor of the first solution,
right ?

What else than the label would you like to customize ? If you
customize any variable that is use by several sections (i.e. 'attr'
then it will be applied to all sections), don't you think it is bad ?

On Jun 17, 10:36 am, Christophe COEVOET <s...@notk.org> wrote:
> Le 17/06/2011 10:17, victor berchet a crit :
>
>
>
>
>
>
>
> > I would like to get some feedback on a feature I would like to drop
> > from the rendering of forms (concerns both twig and php).
>
> > You can give some variables when rendering a view and they will be
> > forwarded to each sub sections of the view.
> > For example when you render a row:
> > form_row(form.name, {'label' : 'custom'})
> > Then the label text is forwarded and used when rendering the label
> > section of form.name.
>
> > For reference, the block fiel_row is:
> > {% block field_row %}
> > {% spaceless %}
> >      <div>
> >          {{ form_label(form) }}
> >          {{ form_errors(form) }}
> >          {{ form_widget(form) }}
> >      </div>
> > {% endspaceless %}
> > {% endblock field_row %}
>
> > One problem which this approach is that recently label was modified to
> > accept attributes (class, ...).
>
> > Then if you do something like
> > form_row(form.name, {'label' : 'custom', 'attr': {'class' : 'pretty'})
> > The pretty class would be applied to both the label and the widget
> > sections which is probably not what you want to do.
>
> > For reference, labels accepts variable since:
> >https://github.com/symfony/symfony/commit/cb22ccc516d07069f0f588c8258...
>
> > In fact this is the intended behavior that I broke by fixing an other
> > issue:
> >https://github.com/symfony/symfony/issues/1157
>
> > So as of today the behavior is that the extra variables (label and
> > attr in the previous example) are forwarded to the first rendered
> > section only (i.e. the label but errors and widget would not receive
> > them).
>
> > This was for the background, now the question:
>
> > There are two ways to move forward:
>
> > 1. Either fix the rendering to actually forward the variables to all
> > the sections (label plus errors and widget in the previous example)
> > 2. Drop this feature. In such a case you would not be able to
> > customize your view by rendering form_row(form.name) but you would
> > have to explicitly render the label, the errors and the widget (i.e.
> > expanding the field_row block to include your customization)
>
> > What solution do you think is the best ?
>
> > If being able to customize the label while rendering a row
> > (form_row(form.name, {'label' : 'custom'})) is a common requirement,
> > this could be achieved with the second solution by slightly changing
> > the block:
> > {% block field_row %}
> > {% spaceless %}
> >      <div>
> >          {{ form_label(form, label) }}
> >          {{ form_errors(form) }}
> >          {{ form_widget(form) }}
> >      </div>
> > {% endspaceless %}
> > {% endblock field_row %}
>
> > Hope this is clear enough ?
>
> I would like to keep the ability to customize the rendering while
> rendering a row. Forcing to render the row manually means that user will
> need to take care of type that have a specific format for the row
> rendering, just to be able to change the label (otherwise some part
> could be missing).
>
> --
> Christophe | Stof

-- 
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

Reply via email to