@@ -463,8 +463,8 @@ we talk about next!).
463
463
464
464
.. caution ::
465
465
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 ``.
468
468
You'll learn more about the ``removeTag `` method later in this article.
469
469
470
470
.. sidebar :: Doctrine: Cascading Relations and saving the "Inverse" side
@@ -729,20 +729,20 @@ the relationship between the removed ``Tag`` and ``Task`` object.
729
729
updated (whether you're adding new tags or removing existing tags) on
730
730
each Tag object itself.
731
731
732
- .. _cookbook-form-collections-custom-prototype
732
+ .. _cookbook-form-collections-custom-prototype :
733
733
734
734
Rendering a Custom Prototype
735
735
----------------------------
736
736
737
737
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:
740
740
741
741
.. configuration-block ::
742
742
743
743
.. code-block :: html+jinja
744
744
745
- <!-- src/Acme/TaskBundle/ Resources/views/Task/prototypeTask.html.twig -->
745
+ {# app/ Resources/views/Task/prototypeTask.html.twig #}
746
746
data-prototype="{% filter escape %}
747
747
{% include 'AcmeTaskBundle:Task: prototypeTask.html.twig'
748
748
with { 'task': form.task.get('prototype') }
@@ -751,7 +751,7 @@ you need to have a complete custom prototype, you can render it yourself:
751
751
752
752
.. code-block :: html+php
753
753
754
- <!-- src/Acme/TaskBundle /Resources/views/Task/prototypeTask.html.php -->
754
+ <!-- app /Resources/views/Task/prototypeTask.html.php -->
755
755
data-prototype="<?php
756
756
$prototype = $view->render(
757
757
'AcmeTaskBundle:Task: prototypeTask.html.php',
@@ -761,7 +761,8 @@ you need to have a complete custom prototype, you can render it yourself:
761
761
echo $view->escape($prototype);
762
762
?>"
763
763
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:
765
766
766
767
.. configuration-block ::
767
768
@@ -779,29 +780,29 @@ To be not confused let's have a look how the prototype-template might look like.
779
780
<td><?php echo $view['form']->widget($task->getDueDate()) ?></td>
780
781
</tr>
781
782
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:
786
787
787
788
.. configuration-block ::
788
789
789
790
.. code-block :: html+jinja
790
791
791
792
{% for task in tasks %}
792
- {% include 'AcmeTaskBundle :Task: prototypeTask.html.twig'
793
+ {% include 'task/ prototypeTask.html.twig'
793
794
with { 'form': form.task.vars.form }
794
795
%}
795
796
{% endfor %}
796
797
797
798
.. code-block :: html+php
798
799
799
800
<?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 ?>
802
803
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.
805
806
806
807
.. _`Owning Side and Inverse Side` : http://docs.doctrine-project.org/en/latest/reference/unitofwork-associations.html
807
808
.. _`JSFiddle` : http://jsfiddle.net/847Kf/4/
0 commit comments