Commit 832c78f
committed
feature #12050 [Form] Added "label_format" option (webmozart)
This PR was merged into the 2.6-dev branch.
Discussion
----------
[Form] Added "label_format" option
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11456
| License | MIT
| Doc PR | TODO
This PR replaces #11456. It adds a "label_format" option which allows to configure a format for generating labels. Two placeholders are available: `%name%` and `%id%`.
**Feedback wanted**: Should we change the placeholders to `{{ name }}` and `{{ id }}`?
The option is inherited from the parent form if not set explicitly on a field:
```php
$form = $this->createForm('myform', $data, array('label_format' => 'form.label.%id%'));
```
Follow-up PR: Make the default label format and translation domain configurable in config.yml.
Commits
-------
aad442d [Form] Added "label_format" optionFile tree
Expand file treeCollapse file tree
6 files changed
+132
-4
lines changedOpen diff view settings
Filter options
- src/Symfony
- Bridge/Twig/Resources/views/Form
- Bundle/FrameworkBundle/Resources/views/Form
- Component/Form
- Extension/Core/Type
- Tests
Expand file treeCollapse file tree
6 files changed
+132
-4
lines changedOpen diff view settings
Collapse file
src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig+16-2Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | | - |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
181 | 188 | |
182 | 189 | |
183 | 190 | |
| ||
203 | 210 | |
204 | 211 | |
205 | 212 | |
206 | | - |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
207 | 221 | |
208 | 222 | |
209 | 223 | |
|
Collapse file
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php
Copy file name to clipboard+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | | - |
| 1 | + |
| 2 | + |
| 3 | + |
2 | 4 | |
Collapse file
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php
Copy file name to clipboard+3-1Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | 3 | |
4 | | - |
| 4 | + |
| 5 | + |
| 6 | + |
5 | 7 | |
6 | 8 | |
Collapse file
src/Symfony/Component/Form/CHANGELOG.md
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/CHANGELOG.md+1Lines changed: 1 addition & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
| 9 | + |
9 | 10 | |
10 | 11 | |
11 | 12 | |
|
Collapse file
src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/BaseType.php+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
44 | 44 | |
45 | 45 | |
46 | 46 | |
| 47 | + |
47 | 48 | |
48 | 49 | |
49 | 50 | |
| ||
59 | 60 | |
60 | 61 | |
61 | 62 | |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
62 | 67 | |
63 | 68 | |
64 | 69 | |
| ||
87 | 92 | |
88 | 93 | |
89 | 94 | |
| 95 | + |
90 | 96 | |
91 | 97 | |
92 | 98 | |
| ||
111 | 117 | |
112 | 118 | |
113 | 119 | |
| 120 | + |
114 | 121 | |
115 | 122 | |
116 | 123 | |
|
Collapse file
src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/AbstractLayoutTest.php+102Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
283 | 283 | |
284 | 284 | |
285 | 285 | |
| 286 | + |
| 287 | + |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | + |
| 293 | + |
| 294 | + |
| 295 | + |
| 296 | + |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
| 330 | + |
| 331 | + |
| 332 | + |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
| 339 | + |
| 340 | + |
| 341 | + |
| 342 | + |
| 343 | + |
| 344 | + |
| 345 | + |
| 346 | + |
| 347 | + |
| 348 | + |
| 349 | + |
| 350 | + |
| 351 | + |
| 352 | + |
| 353 | + |
| 354 | + |
| 355 | + |
| 356 | + |
| 357 | + |
| 358 | + |
| 359 | + |
| 360 | + |
| 361 | + |
| 362 | + |
| 363 | + |
| 364 | + |
| 365 | + |
| 366 | + |
| 367 | + |
| 368 | + |
| 369 | + |
| 370 | + |
| 371 | + |
| 372 | + |
| 373 | + |
| 374 | + |
| 375 | + |
| 376 | + |
| 377 | + |
| 378 | + |
| 379 | + |
| 380 | + |
| 381 | + |
| 382 | + |
| 383 | + |
| 384 | + |
| 385 | + |
| 386 | + |
| 387 | + |
286 | 388 | |
287 | 389 | |
288 | 390 | |
|
0 commit comments