11
11
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color
12
12
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/color#Value wrt value
13
13
*/
14
- class ColorField extends TextField {
14
+ class ColorField extends TextField
15
+ {
15
16
16
17
use Core;
17
18
use Datalist;
@@ -24,7 +25,8 @@ class ColorField extends TextField {
24
25
* Returns the value saved as a 6 chr RGB colour with # prefixed
25
26
* @return string
26
27
*/
27
- public function dataValue () {
28
+ public function dataValue ()
29
+ {
28
30
$ value = $ this ->getValidRGB ($ this ->value );
29
31
return $ value ;
30
32
}
@@ -42,7 +44,8 @@ public function Value()
42
44
* @param string $value an RGB colour value as a 'valid simple colour'
43
45
* @return void
44
46
*/
45
- public function setValue ($ value , $ data = null ) {
47
+ public function setValue ($ value , $ data = null )
48
+ {
46
49
$ this ->value = $ this ->getValidRGB ($ value );
47
50
}
48
51
@@ -61,7 +64,8 @@ public function setValue($value, $data = null) {
61
64
* representing the red component, the middle two digits representing the green component,
62
65
* and the last two digits representing the blue component, in hexadecimal.</blockquote>
63
66
*/
64
- public function getValidRGB ($ value , Validator $ validator = null ) {
67
+ public function getValidRGB ($ value , Validator $ validator = null )
68
+ {
65
69
66
70
// empty values default to the empty value value
67
71
if (!$ value ) {
@@ -71,7 +75,7 @@ public function getValidRGB($value, Validator $validator = null) {
71
75
$ value = strtolower ($ value );
72
76
73
77
// If input is not exactly seven characters long, then return an error.
74
- if (mb_strlen ( $ value ) != 7 ) {
78
+ if (mb_strlen ($ value ) != 7 ) {
75
79
if ($ validator ) {
76
80
$ validator ->validationError (
77
81
$ this ->name ,
0 commit comments