-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Add tel and color types #22679
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9b7c39d
add tel and color types
6a08ffb
remove duplication and add full name
60917c3
add tests for new types
bb0f316
add boostrap 3 layout tests for new types
9980a84
revert contributors to master branch
4c431e6
revert form.xml to master branch
b6d7177
update templates with new types and rename TelType to TelephoneType
081e64e
fix block prefix
3c14d32
update minimum version required
3c5f3eb
use class reference
e26e0ca
rename and fix tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
1 change: 1 addition & 0 deletions
1
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/color_widget.html.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'color')); |
1 change: 1 addition & 0 deletions
1
src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/tel_widget.html.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php echo $view['form']->block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'tel')); |
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
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/Form/Extension/Core/Type/ColorType.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Form\Extension\Core\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
class ColorType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParent() | ||
{ | ||
return TextType::class; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockPrefix() | ||
{ | ||
return 'color'; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Symfony/Component/Form/Extension/Core/Type/TelType.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Form\Extension\Core\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
|
||
class TelType extends AbstractType | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParent() | ||
{ | ||
return TextType::class; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getBlockPrefix() | ||
{ | ||
return 'tel'; | ||
} | ||
} |
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
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
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
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
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
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.
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.
i definitely prefer
TelephoneType
here 🤔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.
I was quite unsure about what name to use, so I chose the one that matches the "tel" HTML5 input name but I have to admit it is less clear
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.
i think fully qualified is preferred :)
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.
I'll rename the class then thank you !
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.
@javiereguiluz agree?
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.
Still no consensus about how the class should be named ? @fabpot @nicolas-grekas @xabbuh
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.
Hello, I'd like to finish this PR, how should I name the class ? TelType, TelephoneType, PhoneType etc ? @symfony/deciders @fabpot
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.
either way no blocker for me :) i understand we just want type="tel" one way or another 👍 (my reasoning still stands though(.
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.
I think we should go with types that match the html types because that's we we tend to do instead of trying to name them based of the semantic of the field (
CheckboxType
,TextareaType
,RangeType
are good examples of this).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.
@ro0NL I think your reasoning was wrong here when stating this (about "tel"):
HTML5 is exactly the opposite to an implementation detail: it's a public interface, a standard, the tip of the iceberg. So we should definitely not seek to be more clever than the ppl who wrote it (we're not ;) ).