-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Documented the new label_format option #4412
Changes from all commits
75d70c4
e4f8dbe
db73c37
be5ed52
9721019
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
label_format | ||
~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 2.6 | ||
The ``label_format`` option was introduced in Symfony 2.6 | ||
|
||
**type**: ``string`` **default**: The label is the "humanized" version of the field name. | ||
|
||
Sets the format applied to generate the ``<label>`` element, which will be used when | ||
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. you should add a note saying that this option has no effect at all if you set the |
||
rendering the label for the field. This option supports two placeholders called | ||
``%name%`` and ``%id%``:: | ||
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. could you please add a short explaination for name and id? (name = name of the field, id = name of each parent field + name of the field). |
||
|
||
// defining the label format for all the form fields | ||
$form = $this->createForm('myform', $data, array('label_format' => 'form.label.%id%')); | ||
|
||
// defining the label format for an individual form field (otherwise the label | ||
// format is inherited from the parent form) | ||
$builder->add('some_field', 'some_type', array( | ||
// ... | ||
'label_format' => '%name% (%id%)', | ||
)); |
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.
what is the default value? we should provide this info?
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.
the default value of the option is
null
, which will then trigger the generation of the label based on the form name