Skip to content

Commit 883402c

Browse files
committed
Improve fixes
1 parent bcf3633 commit 883402c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

cookbook/form/form_customization.rst

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ You can also render each of the three parts of the field individually:
4141
.. code-block:: php
4242
4343
<div>
44-
<?php echo $view['form']->label($form['age']) }} ?>
45-
<?php echo $view['form']->errors($form['age']) }} ?>
46-
<?php echo $view['form']->widget($form['age']) }} ?>
44+
<?php echo $view['form']->label($form['age']); ?>
45+
<?php echo $view['form']->errors($form['age']); ?>
46+
<?php echo $view['form']->widget($form['age']); ?>
4747
</div>
4848
4949
In both cases, the form label, errors and HTML widget are rendered by using
@@ -71,7 +71,7 @@ just one line:
7171
7272
.. code-block:: php
7373
74-
<?php echo $view['form']->widget($form) }} ?>
74+
<?php echo $view['form']->widget($form); ?>
7575
7676
The remainder of this recipe will explain how every part of the form's markup
7777
can be modified at several different levels. For more information about form
@@ -645,7 +645,6 @@ which part of the field is being customized. For example:
645645
<?php echo $view['form']->widget($form['name']); ?>
646646

647647
<!-- src/Acme/DemoBundle/Resources/views/Form/_product_name_widget.html.php -->
648-
649648
<div class="text_widget">
650649
echo $view['form']->block('form_widget_simple') ?>
651650
</div>
@@ -666,6 +665,8 @@ You can also override the markup for an entire field row using the same method:
666665

667666
.. code-block:: html+jinja
668667

668+
{% form_theme form _self %}
669+
669670
{% block _product_name_row %}
670671
<div class="name_row">
671672
{{ form_label(form) }}
@@ -674,10 +675,16 @@ You can also override the markup for an entire field row using the same method:
674675
</div>
675676
{% endblock %}
676677

678+
{{ form_row(form.name) }}
679+
677680
.. code-block:: html+php
678681

679-
<!-- _product_name_row.html.php -->
682+
<!-- Main template -->
683+
<?php echo $view['form']->setTheme($form, array('AcmeDemoBundle:Form')); ?>
684+
685+
<?php echo $view['form']->row($form['name']); ?>
680686

687+
<!-- src/Acme/DemoBundle/Resources/views/Form/_product_name_row.html.php -->
681688
<div class="name_row">
682689
<?php echo $view['form']->label($form) ?>
683690
<?php echo $view['form']->errors($form) ?>

0 commit comments

Comments
 (0)