8000 [Form] Added "label_format" option by webmozart · Pull Request #12050 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Merged
merged 1 commit into from
Sep 30, 2014
Merged

Conversation

webmozart
Copy link
Contributor
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:

$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.

@hason
Copy link
Contributor
hason commented Sep 26, 2014

We should prefer placeholders {name} and {id} which are compatible with MessageFormatter. See #11948 an #6009.

@DavidBadura
Copy link
Contributor

+1 for {name} and {id} which are compatible with MessageFormatter.

@stof
Copy link
Member
stof commented Sep 26, 2014

@hason This has nothing to do with MessageFormatter IMO. They are not translation placeholders here. They are used to build the translation key.

@stof
Copy link
Member
stof commented Sep 26, 2014

I vote for keeping the % syntax here.

And I'm 👍 for this. It would be useful.

@webmozart it would be great to create the doc PR

@stof stof added the Form label Sep 26, 2014
@webmozart
Copy link
Contributor Author

We should probably unify the placeholder syntax with 3.0. It doesn't make sense to introduce a third syntax ({var}) when we already have two.

@webmozart webmozart merged commit aad442d into symfony:master Sep 30, 2014
webmozart added a commit that referenced this pull request Sep 30, 2014
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
@weaverryan
Copy link
Member

@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!

@webmozart
Copy link
Contributor Author

@weaverryan Yes, thanks for mentioning!

@webmozart webmozart deleted the issue11456 branch October 22, 2014 17:20
wouterj added a commit to symfony/symfony-docs that referenced this pull request Feb 6, 2016
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0