Skip to content

Conversation

@Bup3
Copy link

@Bup3 Bup3 commented May 24, 2013

[Form] [FormView] Added $state to setRendered function

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

Made form view better 👍

@stof
Copy link
Member

stof commented May 24, 2013

-1. If it has already been rendered once, there is no reason to set it to false again

@Bup3
Copy link
Author

Bup3 commented May 24, 2013

I have the Problem, that i set a formview rendered but i doesnt rendered it.
And now i the form_widget rendered...

@stof
Copy link
Member

stof commented May 24, 2013

Well, why are you setting it as rendered without rendering it ?

@Bup3
Copy link
Author

Bup3 commented May 24, 2013

Because i use After the Set rendered = True a form_widget...
And After a Few steps i Need the Not rendered Form...

Its a change which made Things better and which is compatible which the Last Versions....

@stof
Copy link
Member

stof commented May 25, 2013

I still don't understand why you need to set a form view as rendered without rendering it and then set it again as not rendered. Please explain your use case

@Bup3
Copy link
Author

Bup3 commented May 27, 2013

Having a form template like...

a.html.twig

{% block content %}
    {% block form %}
        {{ form_widget(form) }}
    {% endblock form %}
{% endblock content %}

b.html.twig (render this)

{% extends "a.html.twig" %}

{% block form %}
    {% form.xyz.setRendered() %}
    {{ parent() }}
    {# ...... other things ........ #}
    {% form.xyz.setRendered(false) %}
    {{ form_widget(form.xyz) }}
{% endblock form %}

And i use a twig extension for that, too.

@fabpot
Copy link
Member

fabpot commented Jul 21, 2013

That's not a use case that we want to support in core as it looks really weird. There is probably a better way to achieve what you are trying to do... which we cannot really say with the small snippet of code your provided in the comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants