This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Adding attributes to fieldsets. Legends are optional for fieldsets. #5623
Closed
Conversation
This file contains 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
As the comment says: Every collection is wrapped by a fieldset if needed A legend is not required for a fieldset. * Now, if a label is specified, a legend will be created. * Before, a fieldset would not be wrapped around the markup unless a label was set. * Now, a fieldset will be wrapped around the markup if $this->shouldWrap is true, regardless if a label has been set for the legend.
It failed a test because of a space: Failed asserting that '<form action="" method="POST" name="login-form" id="login-form"><fieldset ><label><span>Name of the city</span><input name="city[name]" type="text" value=""></label><label><span>ZipCode of the city</span><input name="city[zipCode]" type="text" value=""></label><fieldset ><legend>Country</legend><label><span>Name of the country</span><input name="city[country][name]" type="text" value=""></label><label><span>Continent of the city</span><input name="city[country][continent]" type="text" value=""></label></fieldset></fieldset><input type="submit" name="send" value=""></form>' contains "<fieldset><legend>Country</legend>".
Has an extra space to accomodate fieldset attributes.
This was in test: |
Here is a similar patch against 2.3: |
Add a unit test for the changes that you've made.
|
|
||
$markup = sprintf( | ||
'<fieldset %s>%s%s</fieldset>', | ||
$this->createAttributesString($attributes), |
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.
If you call createAttributesString()
prior to the sprintf
call, you can prefix the string with a space if it's non-empty. This will prevent the need to have a <fieldset >
declaration.
weierophinney
added a commit
that referenced
this pull request
Mar 3, 2014
Adding attributes to fieldsets. Legends are optional for fieldsets.
weierophinney
added a commit
that referenced
this pull request
Mar 3, 2014
- Added tests covering the various use cases: - fieldset without attributes - fieldset with attributes - fieldset without label - fieldset with label renders as legend - Fixed code submission to only provide attributes in opening fieldset tag *IF* present
weierophinney
added a commit
that referenced
this pull request
Mar 3, 2014
Forward port #5623 Conflicts: library/Zend/Form/View/Helper/FormCollection.php tests/ZendTest/Form/View/Helper/FormCollectionTest.php
@gammamatrix I made the changes requested on merge; a similar change was already on the develop branch. |
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.
As the comment says: Every collection is wrapped by a fieldset if needed
With this patch, a legend is not required for a fieldset.