Skip to content

Commit dbcabd3

Browse files
committed
Added some diagrams
1 parent 3d2e33d commit dbcabd3

5 files changed

+14
-7
lines changed

_images/form/form-custom-type-postal-address-fragment-names.svg

Lines changed: 1 addition & 0 deletions
Loading

_images/form/form-custom-type-postal-address.svg

Lines changed: 1 addition & 0 deletions
Loading
Binary file not shown.
Binary file not shown.

form/create_custom_field_type.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ any :doc:`existing form types </reference/form/types>` because they are too
106106
different. Consider an application that wants to reuse in different forms the
107107
following set of fields as the "postal address":
108108

109-
.. TODO: illustration of the form field
109+
.. raw:: html
110+
111+
<object data="../_images/form/form-custom-type-postal-address.svg" type="image/svg+xml"></object>
110112

111113
As explained above, form types are PHP classes that implement
112114
:class:`Symfony\\Component\\Form\\FormTypeInterface`, although it's more
@@ -177,10 +179,10 @@ in the postal address. For the moment, all fields are of type ``TextType``::
177179
])
178180
->add('city', TextType::class)
179181
->add('state', TextType::class, [
180-
'label' => 'State/Province/Region',
182+
'label' => 'State',
181183
])
182184
->add('zipCode', TextType::class, [
183-
'label' => 'ZIP/Postal Code',
185+
'label' => 'ZIP Code',
184186
])
185187
;
186188
}
@@ -250,7 +252,7 @@ learn about all you can do with these options::
250252
public function configureOptions(OptionsResolver $resolver)
251253
{
252254
// this defines the available options and their default values when
253-
// they are not configured explicitly when using the form
255+
// they are not configured explicitly when using the form type
254256
$resolver->setDefaults([
255257
'allowed_states' => null,
256258
'is_extended_address' => false,
@@ -417,10 +419,13 @@ by overriding the ``getBlockPrefix()`` method in ``PostalAddressType``. The
417419
second part of the Twig block name (e.g. ``_row``) defines which form type part
418420
is being rendered (row, widget, help, errors, etc.)
419421

420-
.. seealso::
422+
The article about form themes explains the
423+
:ref:`form fragment naming rules <form-fragment-naming>` in detail. The
424+
following diagram shows some of the Twig block names defined in this example:
425+
426+
.. raw:: html
421427

422-
The article about form themes explains the
423-
:ref:`form fragment naming rules <form-fragment-naming>` in detail.
428+
<object data="../_images/form/form-custom-type-postal-address-fragment-names.svg" type="image/svg+xml"></object>
424429

425430
.. caution::
426431

0 commit comments

Comments
 (0)