Skip to content

Commit e069e66

Browse files
committed
Fixed code examples in book/forms
1 parent 8b3605a commit e069e66

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

book/forms.rst

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ helper functions:
147147
.. code-block:: html+jinja
148148

149149
{# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #}
150-
151150
<form action="{{ path('task_new') }}" method="post" {{ form_enctype(form) }}>
152151
{{ form_widget(form) }}
153152

@@ -157,7 +156,6 @@ helper functions:
157156
.. code-block:: html+php
158157

159158
<!-- src/Acme/TaskBundle/Resources/views/Default/new.html.php -->
160-
161159
<form action="<?php echo $view['router']->generate('task_new') ?>" method="post" <?php echo $view['form']->enctype($form) ?> >
162160
<?php echo $view['form']->widget($form) ?>
163161

@@ -386,8 +384,7 @@ you'll need to specify which validation group(s) your form should use::
386384

387385
$form = $this->createFormBuilder($users, array(
388386
'validation_groups' => array('registration'),
389-
))->add(...)
390-
;
387+
))->add(...);
391388

392389
If you're creating :ref:`form classes<book-form-creating-form-classes>` (a
393390
good practice), then you'll need to add the following to the ``getDefaultOptions()``
@@ -558,7 +555,6 @@ of code. Of course, you'll usually need much more flexibility when rendering:
558555
.. code-block:: html+jinja
559556

560557
{# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #}
561-
562558
<form action="{{ path('task_new') }}" method="post" {{ form_enctype(form) }}>
563559
{{ form_errors(form) }}
564560

@@ -572,8 +568,7 @@ of code. Of course, you'll usually need much more flexibility when rendering:
572568

573569
.. code-block:: html+php
574570

575-
<!-- // src/Acme/TaskBundle/Resources/views/Default/newAction.html.php -->
576-
571+
<!-- src/Acme/TaskBundle/Resources/views/Default/newAction.html.php -->
577572
<form action="<?php echo $view['router']->generate('task_new') ?>" method="post" <?php echo $view['form']->enctype($form) ?>>
578573
<?php echo $view['form']->errors($form) ?>
579574

@@ -754,7 +749,6 @@ that will house the logic for building the task form:
754749
.. code-block:: php
755750
756751
// src/Acme/TaskBundle/Form/Type/TaskType.php
757-
758752
namespace Acme\TaskBundle\Form\Type;
759753
760754
use Symfony\Component\Form\AbstractType;
@@ -787,7 +781,7 @@ form "type"). It can be used to quickly build a form object in the controller:
787781
788782
public function newAction()
789783
{
790-
$task = // ...
784+
$task = ...;
791785
$form = $this->createForm(new TaskType(), $task);
792786
793787
// ...
@@ -1052,7 +1046,6 @@ do this, create a new template file that will store the new markup:
10521046
.. code-block:: html+jinja
10531047

10541048
{# src/Acme/TaskBundle/Resources/views/Form/fields.html.twig #}
1055-
10561049
{% block field_row %}
10571050
{% spaceless %}
10581051
<div class="form_row">
@@ -1066,7 +1059,6 @@ do this, create a new template file that will store the new markup:
10661059
.. code-block:: html+php
10671060

10681061
<!-- src/Acme/TaskBundle/Resources/views/Form/field_row.html.php -->
1069-
10701062
<div class="form_row">
10711063
<?php echo $view['form']->label($form, $label) ?>
10721064
<?php echo $view['form']->errors($form) ?>
@@ -1083,7 +1075,6 @@ renders the form:
10831075
.. code-block:: html+jinja
10841076

10851077
{# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #}
1086-
10871078
{% form_theme form 'AcmeTaskBundle:Form:fields.html.twig' %}
10881079

10891080
{% form_theme form 'AcmeTaskBundle:Form:fields.html.twig' 'AcmeTaskBundle:Form:fields2.html.twig' %}
@@ -1093,7 +1084,6 @@ renders the form:
10931084
.. code-block:: html+php
10941085

10951086
<!-- src/Acme/TaskBundle/Resources/views/Default/new.html.php -->
1096-
10971087
<?php $view['form']->setTheme($form, array('AcmeTaskBundle:Form')) ?>
10981088

10991089
<?php $view['form']->setTheme($form, array('AcmeTaskBundle:Form', 'AcmeTaskBundle:Form')) ?>
@@ -1219,7 +1209,6 @@ file:
12191209
.. code-block:: yaml
12201210
12211211
# app/config/config.yml
1222-
12231212
twig:
12241213
form:
12251214
resources:
@@ -1229,7 +1218,6 @@ file:
12291218
.. code-block:: xml
12301219
12311220
<!-- app/config/config.xml -->
1232-
12331221
<twig:config ...>
12341222
<twig:form>
12351223
<resource>AcmeTaskBundle:Form:fields.html.twig</resource>
@@ -1240,7 +1228,6 @@ file:
12401228
.. code-block:: php
12411229
12421230
// app/config/config.php
1243-
12441231
$container->loadFromExtension('twig', array(
12451232
'form' => array('resources' => array(
12461233
'AcmeTaskBundle:Form:fields.html.twig',
@@ -1297,7 +1284,6 @@ file:
12971284
.. code-block:: yaml
12981285
12991286
# app/config/config.yml
1300-
13011287
framework:
13021288
templating:
13031289
form:
@@ -1309,7 +1295,6 @@ file:
13091295
.. code-block:: xml
13101296
13111297
<!-- app/config/config.xml -->
1312-
13131298
<framework:config ...>
13141299
<framework:templating>
13151300
<framework:form>
@@ -1322,7 +1307,6 @@ file:
13221307
.. code-block:: php
13231308
13241309
// app/config/config.php
1325-
13261310
$container->loadFromExtension('framework', array(
13271311
'templating' => array('form' =>
13281312
array('resources' => array(

0 commit comments

Comments
 (0)