Skip to content

Commit 06bcb61

Browse files
committed
some tweaks
1 parent 6f3ef09 commit 06bcb61

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

cookbook/form/form_collections.rst

+18-17
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ we talk about next!).
463463

464464
.. caution::
465465

466-
You have to create **both** ``addTag`` and ``removeTag`` methods,
467-
otherwise the form will still use ``setTag`` even if ``by_reference`` is ``false``.
466+
You have to create **both** ``addTag`` and ``removeTag`` methods,
467+
otherwise the form will still use ``setTag`` even if ``by_reference`` is ``false``.
468468
You'll learn more about the ``removeTag`` method later in this article.
469469

470470
.. sidebar:: Doctrine: Cascading Relations and saving the "Inverse" side
@@ -729,20 +729,20 @@ the relationship between the removed ``Tag`` and ``Task`` object.
729729
updated (whether you're adding new tags or removing existing tags) on
730730
each Tag object itself.
731731

732-
.. _cookbook-form-collections-custom-prototype
732+
.. _cookbook-form-collections-custom-prototype:
733733

734734
Rendering a Custom Prototype
735735
----------------------------
736736

737737
Most of the time the provided prototype will be sufficient for your needs
738-
and does not need to be changed. But if you are in the situation were
739-
you need to have a complete custom prototype, you can render it yourself:
738+
and does not need to be changed. But if you are in the situation were you
739+
need to have a complete custom prototype, you can render it yourself:
740740

741741
.. configuration-block::
742742

743743
.. code-block:: html+jinja
744744

745-
<!-- src/Acme/TaskBundle/Resources/views/Task/prototypeTask.html.twig -->
745+
{# app/Resources/views/Task/prototypeTask.html.twig #}
746746
data-prototype="{% filter escape %}
747747
{% include 'AcmeTaskBundle:Task:prototypeTask.html.twig'
748748
with { 'task': form.task.get('prototype') }
@@ -751,7 +751,7 @@ you need to have a complete custom prototype, you can render it yourself:
751751

752752
.. code-block:: html+php
753753

754-
<!-- src/Acme/TaskBundle/Resources/views/Task/prototypeTask.html.php -->
754+
<!-- app/Resources/views/Task/prototypeTask.html.php -->
755755
data-prototype="<?php
756756
$prototype = $view->render(
757757
'AcmeTaskBundle:Task:prototypeTask.html.php',
@@ -761,7 +761,8 @@ you need to have a complete custom prototype, you can render it yourself:
761761
echo $view->escape($prototype);
762762
?>"
763763

764-
To be not confused let's have a look how the prototype-template might look like.
764+
To be not confused, have a look at the following example to see how the prototype
765+
template might look like:
765766

766767
.. configuration-block::
767768

@@ -779,29 +780,29 @@ To be not confused let's have a look how the prototype-template might look like.
779780
<td><?php echo $view['form']->widget($task->getDueDate()) ?></td>
780781
</tr>
781782

782-
The included template contains the markup used for the prototype.
783-
This way you can not only easily structure your prototype-markup,
784-
you can also use this markup to render the
785-
contents of the collection when it already holds items:
783+
The included template contains the markup used for the prototype. This way,
784+
you can not only easily structure your prototype-markup, but you can also
785+
use this markup to render the contents of the collection when it already contains
786+
items:
786787

787788
.. configuration-block::
788789

789790
.. code-block:: html+jinja
790791

791792
{% for task in tasks %}
792-
{% include 'AcmeTaskBundle:Task:prototypeTask.html.twig'
793+
{% include 'task/prototypeTask.html.twig'
793794
with { 'form': form.task.vars.form }
794795
%}
795796
{% endfor %}
796797

797798
.. code-block:: html+php
798799

799800
<?php foreach ($tasks as $task) ?>
800-
<?php echo $view->render('AcmeTaskBundle:Task:prototypeTask.html.php', array('form' => $form->task->vars->form)); ?>
801-
<?php endforeach; ?>
801+
<?php echo $view->render('task/prototypeTask.html.php', array('form' => $form->task->vars->form)); ?>
802+
<?php endforeach ?>
802803

803-
This makes sure the displayed items are the same as the newly inserted
804-
from the prototype.
804+
This ensures that the displayed items are the same as the newly inserted ones
805+
based on the prototype.
805806

806807
.. _`Owning Side and Inverse Side`: http://docs.doctrine-project.org/en/latest/reference/unitofwork-associations.html
807808
.. _`JSFiddle`: http://jsfiddle.net/847Kf/4/

0 commit comments

Comments
 (0)