Skip to content

Commit b751d42

Browse files
committed
Fix syntax
1 parent 18926d4 commit b751d42

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

forms.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -948,19 +948,18 @@ Additionally, if there are any fields on the form that aren't included in
948948
the submitted data, those fields will be explicitly set to ``null``.
949949

950950
Extra fields
951-
~~~~~~~~~~~~~~~
951+
~~~~~~~~~~~~
952952

953-
All form fields are considered properties of the object but you can inject fields
954-
directly into your view without specifying them in the form definition.
955-
They can be retrieved via the ``getExtraData`` :class:`Symfony\\Component\\Form\\FormTypeInterface`.
953+
All form fields are considered properties of the object but you can inject fields directly into your view without specifying them in the form definition.
954+
They can be retrieved via the ``getExtraData`` :class:`Symfony\\Component\\Form\\FormTypeInterface`.
956955

957956
This is a creation user form::
958957

959958
// ...
959+
use App\User;
960960
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
961961
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
962962
use Symfony\Component\Form\FormBuilderInterface;
963-
use App\User;
964963

965964
class UserCreateType extends AbstractType
966965
{
@@ -980,7 +979,9 @@ This is a creation user form::
980979
}
981980
}
982981

983-
The extra fields can be injected like this::
982+
The extra fields can be injected like this:
983+
984+
.. code-block:: twig
984985
985986
{# templates/user/create.html.twig #}
986987
{{ form_start(form) }}
@@ -995,7 +996,7 @@ The extra fields can be injected like this::
995996
996997
Here, the sponsorship code is an extra field injected at view level.
997998

998-
You can get the referraCode via ``getExtraData``::
999+
You can get the referraCode via ``getExtraData``::
9991000

10001001
$extraData = $form->getExtraData();
10011002
$referraCode = $extraData['referralCode'] ?? null;

0 commit comments

Comments
 (0)