From e42311892947dc0fb89ace6f0fe7c8a7e07a766e Mon Sep 17 00:00:00 2001 From: Abdellatif AitBoudad Date: Sat, 26 Apr 2014 22:35:45 +0100 Subject: [PATCH 1/2] [Form customization] added block_name example. --- cookbook/form/form_customization.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 554816a1f67..c0e75056b41 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -660,6 +660,25 @@ field whose *id* is ``product_name`` (and name is ``product[name]``). ``ProductType`` equates to ``product``). If you're not sure what your form name is, just view the source of your generated form. + If you want to change the ``product`` or ``name`` portion of the block + name ``_product_name_widget`` you can set the ``block_name`` option in your + form type: + + .. code-block:: php + + use Symfony\Component\Form\FormBuilderInterface; + + public function buildForm(FormBuilderInterface $builder, array $options) + { + // ... + + $builder->add('name', 'text', array( + 'block_name' => 'custom_name' + )); + } + + The block name can then be ``_product_custom_name_widget`` + You can also override the markup for an entire field row using the same method: .. configuration-block:: From 512d5eb25c7df9e454b20da5124434b22d4f8949 Mon Sep 17 00:00:00 2001 From: Abdellatif AitBoudad Date: Sun, 27 Apr 2014 11:54:07 +0100 Subject: [PATCH 2/2] [Form customization] fixed minor typos --- cookbook/form/form_customization.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index c0e75056b41..9ff6975369d 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -662,9 +662,7 @@ field whose *id* is ``product_name`` (and name is ``product[name]``). If you want to change the ``product`` or ``name`` portion of the block name ``_product_name_widget`` you can set the ``block_name`` option in your - form type: - - .. code-block:: php + form type:: use Symfony\Component\Form\FormBuilderInterface; @@ -673,11 +671,11 @@ field whose *id* is ``product_name`` (and name is ``product[name]``). // ... $builder->add('name', 'text', array( - 'block_name' => 'custom_name' + 'block_name' => 'custom_name', )); } - The block name can then be ``_product_custom_name_widget`` + Then the block name will be ``_product_custom_name_widget``. You can also override the markup for an entire field row using the same method: