This repository was archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 87
Stop FormRow from translating the label twice #20
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prevents the label from being translated and processed multiple times. When $labelHelper is invoked with only one argument, it will translate and process the label, and not add anything extra. There is no need for this extra work in FormRow, which has already done this translation. This small change also allows for a more uniform code path when the element has an id and when it does not.
I made a wrong assumption,I will update this pull request when it is fixed. |
Made a small error in my first commit that put the </label> at the end of the element every time.
I fixed the error in my patch. Let me know what I can do to help this pull request pass all tests. It is currently skipping 4 tests in travis-ci. |
I didn't realize it was failing due to extra white space, patch is fixed and is now passing tests. |
Need unit test verifying the bug is fixed |
Translator should only be called once on the element label. These tests make sure this is true whether or not the element has a label.
Tests have been added. Let me know if I need to do more or correct anything. |
$element = new Element('foo'); | ||
$element->setLabel('The value for foo:'); | ||
|
||
$mockTranslator = $this->getMock('Zend\I18n\Translator\Translator'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use PHP 5.5 ::class
and TranslatorInterface
weierophinney
added a commit
that referenced
this pull request
Apr 7, 2016
Stop FormRow from translating the label twice
weierophinney
added a commit
that referenced
this pull request
Apr 7, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prevents the label from being translated and processed multiple times. When $labelHelper is invoked with only one argument, it will translate and process the label, and not add anything extra. There is no need for this extra work in FormRow, which has already done this translation. This small change also allows for a more uniform code path when the element has an id and when it does not.