Skip to content
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

Finish #1998 #4629

Closed
wants to merge 1 commit into from
Closed

Finish #1998 #4629

wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Dec 11, 2014

Q A
Doc fix? no
New docs? no
Applies to all
Fixed tickets replaces #1998


{% for task in tasks %}
{% include 'AcmeTaskBundle:Task:prototypeTask.html.twig'
with { 'form': form.task.vars.form }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't form.task.vars.form be task.vars.form?

@wouterj
Copy link
Member

wouterj commented Dec 11, 2014

If I understand things correctly, this does not use the method proposed by @stof in #1998 (comment), does it?

If so, could you please update this?

@xabbuh
Copy link
Member Author

xabbuh commented Dec 11, 2014

I think you're right. Though I'm not sure what exactly needs to be changed. Does this block replace the call to render() in the loop?

@wouterj
Copy link
Member

wouterj commented Dec 11, 2014

Yes, if I understand it correctly

Op do 11 dec. 2014 19:25 schreef Christian Flothmann <
notifications@github.com>:

I think you're right. Though I'm not sure what exactly needs to be
changed. Does this block replace the call to render() in the loop?


Reply to this email directly or view it on GitHub
#4629 (comment).

@xabbuh
Copy link
Member Author

xabbuh commented Dec 11, 2014

@stof Can you please confirm if we properly understand your suggestion?

@webda2l
Copy link
Contributor

webda2l commented Dec 12, 2014

It's sure that it's not anymore the right way to do since a while... : SF2.1 - http://symfony.com/blog/form-goodness-in-symfony-2-1#collection-improvements)
But lots of people seems ignore it.

An example to render a collection with list UL :

{# tasks collection #}
{% block _tasks_widget %}
{% spaceless %}
    {% set attr = attr|merge({'data-prototype': form_row(prototype) }) %}
    <ul {{ block('widget_container_attributes') }}>
        {% for child in form %}
            {{ form_row(child) }}
        {% endfor %}
    </ul>
{% endspaceless %}
{% endblock %}

{# task child (_tasks_entry_row / _tasks_entry_label / _tasks_entry_widget available) #}
{% block _tasks_entry_row %}
{% spaceless %}
        <li>
            {{ form_row(form.task) }}
            {{ form_row(form.dueDate) }}
        </li>
{% endspaceless %}
{% endblock %}

The prototype attribute will be generated automatically in the right format with LI

@wouterj
Copy link
Member

wouterj commented May 4, 2015

@xabbuh can you please update this PR with the change proposed by @stof? (see also the blogpost referenced by @webda2l)

Btw, can you please also handle #4797. It explains the same thing, but less verbose and in another location. Would be great if we can make both PRs ready to merge!

@wouterj
Copy link
Member

wouterj commented May 21, 2015

@xabbuh can you please take care of this one and #4797?


.. code-block:: html+php

<!-- src/AppBundle/Resources/views/Form/_tasks_widget.html.php -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm stuck how this should look like in the PHP template.

@xabbuh
Copy link
Member Author

xabbuh commented May 21, 2015

@wouterj Do we really need #4797 at all when this is merged? Imho everything should be fine then. The only thing I can image is to add a cross-reference to the other article. What do you think?

@wouterj
Copy link
Member

wouterj commented May 22, 2015

@xabbuh it's up to you :) I think the location of #4797 is better and the form collections article should just reference.

@wouterj
Copy link
Member

wouterj commented Aug 20, 2015

Closing in favor of #5643

@wouterj wouterj closed this Aug 20, 2015
@xabbuh xabbuh deleted the pr-1998-rebase branch August 21, 2015 06:20
xabbuh added a commit that referenced this pull request Oct 3, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Document how to customize the prototype

Finishes #4629 and #4797

| Q | A
| --- | ---
| Doc fix? | no
| New docs? | yes
| Applies to | all
| Fixed tickets | -

Commits
-------

ce8110c Improve docs on customizing prototype rendering
051a23f document how to render custom collection prototypes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants