Skip to content

Commit

Permalink
feature #3818 [Form customization] added block_name example. (aitboudad)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.3 branch.

Discussion
----------

[Form customization] added block_name example.

| Q             | A
| ------------- | ---
| Doc fix?	 | yes
| New docs? | no
| Applies to | all
|Fixed tickets |	-

Commits
-------

512d5eb [Form customization] fixed minor typos
e423118 [Form customization] added block_name example.
  • Loading branch information
weaverryan committed May 15, 2014
2 parents 4ed9a08 + 512d5eb commit af8c20f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cookbook/form/form_customization.rst
Expand Up @@ -660,6 +660,23 @@ field whose *id* is ``product_name`` (and name is ``product[name]``).
``ProductType`` equates to ``product``). If you're not sure what your ``ProductType`` equates to ``product``). If you're not sure what your
form name is, just view the source of your generated form. 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::

use Symfony\Component\Form\FormBuilderInterface;

public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...

$builder->add('name', 'text', array(
'block_name' => 'custom_name',
));
}

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: You can also override the markup for an entire field row using the same method:


.. configuration-block:: .. configuration-block::
Expand Down

0 comments on commit af8c20f

Please sign in to comment.