-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Added "label_format" option #12050
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
Conversation
We should prefer placeholders |
+1 for |
@hason This has nothing to do with MessageFormatter IMO. They are not translation placeholders here. They are used to build the translation key. |
I vote for keeping the And I'm 👍 for this. It would be useful. @webmozart it would be great to create the doc PR |
We should probably unify the placeholder syntax with 3.0. It doesn't make sense to introduce a third syntax ( |
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. I 8000 t 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" option
@webmozart If you can just make a docs issue before you merge, it'll help us make sure we don't miss anything! @xabbuh opened an issue for this, but it's only because he, WouterJ and I are scanning the PR's very closely. Thanks! |
@weaverryan Yes, thanks for mentioning! |
This PR was merged into the 2.7 branch. Discussion ---------- Documented label_format option | Q | A | --- | --- | Doc fix? | no | New docs? | yes (symfony/symfony#12050) | Applies to | 2.6+ | Fixed tickets | #4286 @javiereguiluz abandoned #4412, so I continued #4489. I welcome any improvements, as I'm not 100% sure this is well documented now. Commits ------- ac0fdbc Documented label_format option
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:
Follow-up PR: Make the default label format and translation domain configurable in config.yml.