8000 [Form] Added the 'range' FormType · symfony/symfony@085d385 · GitHub
[go: up one dir, main page]

Skip to content

Commit 085d385

Browse files
committed
[Form] Added the 'range' FormType
1 parent 4e0021b commit 085d385

File tree

6 files changed

+44
-1
lines changed

6 files changed

+44
-1
lines changed

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,3 +1105,4 @@ Symfony2 is the result of the work of many people who made the code better
11051105
- Erik Saunier (snickers)
11061106
- Matej Žilák (teo_sk)
11071107
- Vladislav Vlastovskiy (vlastv)
1108+
- Joshua Thijssen (jaytaph)

src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@
175175
{{- block('form_widget_simple') -}}
176176
{%- endblock email_widget %}
177177

178+
{% block range_widget -%}
179+
{% set type = type|default('range') %}
180+
{{- block('form_widget_simple') -}}
181+
{%- endblock range_widget %}
182+
178183
{% block button_widget -%}
179184
{% if label is empty -%}
180185
{% set label = name|humanize %}

src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@
113113
<service id="form.type.radio" class="Symfony\Component\Form\Extension\Core\Type\RadioType">
114114
<tag name="form.type" alias="radio" />
115115
</service>
116+
<service id="form.type.range" class="Symfony\Component\Form\Extension\Core\Type\RangeType">
117+
<tag name="form.type" alias="range" />
118+
</service>
116119
<service id="form.type.repeated" class="Symfony\Component\Form\Extension\Core\Type\RepeatedType">
117120
<tag name="form.type" alias="repeated" />
118121
</service>

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ CHANGELOG
33

44
2.6.0
55
-----
6-
76
* added "html5" option to Date, Time and DateTimeFormType to be able to
87
enable/disable HTML5 input date when widget option is "single_text"
8+
* added the html5 "range" FormType
99

1010
2.5.0
1111
------

src/Symfony/Component/Form/Extension/Core/CoreExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ protected function loadTypes()
4242
new Type\PasswordType(),
4343
new Type\PercentType(),
4444
new Type\RadioType(),
45+
new Type\RangeType(),
4546
new Type\RepeatedType(),
4647
new Type\SearchType(),
4748
new Type\TextareaType(),
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Form\Extension\Core\Type;
13+
14+
use Symfony\Component\Form\AbstractType;
15+
16+
class RangeType extends AbstractType
17+
{
18+
/**
19+
* {@inheritdoc}
20+
*/
21+
public function getParent()
22+
{
23+
return 'text';
24+
}
25+
26+
/**
27+
* {@inheritdoc}
28+
*/
29+
public function getName()
30+
{
31+
return 'range';
32+
}
33+
}

0 commit comments

Comments
 (0)
0