Skip to content
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

[Form][2.0] wrong label when its value is "0" #6862

Closed
Cethy opened this issue Jan 24, 2013 · 1 comment
Closed

[Form][2.0] wrong label when its value is "0" #6862

Cethy opened this issue Jan 24, 2013 · 1 comment

Comments

@Cethy
Copy link

Cethy commented Jan 24, 2013

I have a choice type with a choice which is labelled "0", when I display it, I have 1 (which is the position of the choice in the choiceList) instead of 0 in my label.

The problem comes from FieldType::55 :
$builder->setAttribute('label', $options['label'] ?: $this->humanize($builder->getName()));
should be
$builder->setAttribute('label', strlen($options['label']) ? $options['label'] : $this->humanize($builder->getName()))

@webmozart
Copy link
Contributor

Fixed in the referenced PR.

fabpot added a commit that referenced this issue Feb 21, 2013
This PR was merged into the 2.0 branch.

Commits
-------

f8812b2 [Form] Fixed "label" option to accept the value "0"

Discussion
----------

[Form] Fixed "label" option to accept the value "0"

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6862
| License       | MIT
| Doc PR        | -

@fabpot: This commit will cause troubles when merging 2.0 into 2.1 and up. Tell me if you need help upon conflict resolution.
@fabpot fabpot closed this as completed Feb 21, 2013
fabpot added a commit that referenced this issue Feb 22, 2013
This PR was merged into the 2.1 branch.

Commits
-------

00fbb7e [Form] Added test for "label" option to accept the value "0"

Discussion
----------

[Form] Added test for "label" option to accept the value "0"

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6862
| License       | MIT
| Doc PR        | -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants