-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Form customization] added block_name example. #3818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. every array item should be suffixed with a comma |
||
)); | ||
} | ||
|
||
The block name can then be ``_product_custom_name_widget`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Then the block name will be |
||
|
||
You can also override the markup for an entire field row using the same method: | ||
|
||
.. configuration-block:: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should use the
::
shorthand instead:form type:: use ...