symfony/symfony — pull request #12882 by cleentfaar (2014-12-07 00:32:01+00:00)
Title: [Form][Translation] Added `choice_label_format` option

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes (adding missing tests now)
| Fixed tickets | #12880
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/4602

### What this adds...
Inspired by the recently added `label_format` option, I wondered if this was worth merging.
Basically, these changes allow us to do this:
```php
add('gender', 'choice', array(
// ...
'choice_label_format' => 'my_form.choices.%name%.%choice%'
));
```

My reason for adding it to the `BaseType` (just like the `label_format` option) is that you could then also define this option on the form itself during construction. It might seem odd to do this but consider the convenience of doing this (within a framework project):
```php
createForm(new SearchType(), null, [
'label_format' => 'docs_search.form.fields.%name%',
'choice_label_format' => 'docs_search.form.choices.%name%.%choice%'
]);
```