Permalink
Browse files

feature #3818 [Form customization] added block_name example. (aitboudad)

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 af8c20fa357695645a98570a916658688894eb6d
Showing with 17 additions and 0 deletions.
  1. +17 −0 cookbook/form/form_customization.rst
@@ -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
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:
.. configuration-block::

0 comments on commit af8c20f

Please sign in to comment.