File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed
Bridge/Twig/Resources/views/Form
Bundle/FrameworkBundle/Resources/config
Component/Form/Extension/Core/Type Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 141
141
{{- block (' form_widget_simple' ) -}}
142
142
{%- endblock integer_widget %}
143
143
144
+ {% block range_widget -%}
145
+ {% set type = type | default (' range' ) %}
146
+ {{- block (' form_widget_simple' ) -}}
147
+ {%- endblock range_widget %}
148
+
144
149
{% block money_widget -%}
145
150
{{ money_pattern | replace ({ ' {{ widget }}' : block (' form_widget_simple' ) })| raw }}
146
151
{%- endblock money_widget %}
Original file line number Diff line number Diff line change 146
146
<service id =" form.type.currency" class =" Symfony\Component\Form\Extension\Core\Type\CurrencyType" >
147
147
<tag name =" form.type" alias =" currency" />
148
148
</service >
149
+ <service id =" form.type.range" class =" Symfony\Component\Form\Extension\Core\Type\RangeType" >
150
+ <tag name =" form.type" alias =" range" />
151
+ </service >
149
152
150
153
<!-- FormTypeHttpFoundationExtension -->
151
154
<service id =" form.type_extension.form.http_foundation" class =" Symfony\Component\Form\Extension\HttpFoundation\Type\FormTypeHttpFoundationExtension" >
Original file line number Diff line number Diff line change
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 \OptionsResolver \OptionsResolverInterface ;
15
+ use Symfony \Component \Form \AbstractType ;
16
+
17
+ /**
18
+ * A range form element.
19
+ *
20
+ * @author Carlos Revillo <crevillo@gmail.com>
21
+ */
22
+ class RangeType extends AbstractType
23
+ {
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public function setDefaultOptions (OptionsResolverInterface $ resolver )
28
+ {
29
+ $ resolver ->setDefaults (array (
30
+ 'min ' => null ,
31
+ 'max ' => null ,
32
+ ));
33
+ }
34
+
35
+ /**
36
+ * {@inheritdoc}
37
+ */
38
+ public function getParent ()
39
+ {
40
+ return 'integer ' ;
41
+ }
42
+
43
+ /**
44
+ * {@inheritdoc}
45
+ */
46
+ public function getName ()
47
+ {
48
+ return 'range ' ;
49
+ }
50
+ }
You can’t perform that action at this time.
0 commit comments