These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Encore\Admin\Form\Field; |
||
4 | |||
5 | class Color extends Text |
||
6 | { |
||
7 | protected static $css = [ |
||
8 | '/vendor/laravel-admin/AdminLTE/plugins/colorpicker/bootstrap-colorpicker.min.css', |
||
9 | ]; |
||
10 | |||
11 | protected static $js = [ |
||
12 | '/vendor/laravel-admin/AdminLTE/plugins/colorpicker/bootstrap-colorpicker.min.js', |
||
13 | ]; |
||
14 | |||
15 | /** |
||
16 | * Use `hex` format. |
||
17 | * |
||
18 | * @return $this |
||
19 | */ |
||
20 | public function hex() |
||
21 | { |
||
22 | return $this->options(['format' => 'hex']); |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * Use `rgb` format. |
||
27 | * |
||
28 | * @return $this |
||
29 | */ |
||
30 | public function rgb() |
||
31 | { |
||
32 | return $this->options(['format' => 'rgb']); |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Use `rgba` format. |
||
37 | * |
||
38 | * @return $this |
||
39 | */ |
||
40 | public function rgba() |
||
41 | { |
||
42 | return $this->options(['format' => 'rgba']); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Render this filed. |
||
47 | * |
||
48 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
49 | */ |
||
50 | View Code Duplication | public function render() |
|
51 | { |
||
52 | $options = json_encode($this->options); |
||
53 | |||
54 | $this->script = "$('{$this->getElementClassSelector()}').parent().colorpicker($options);"; |
||
55 | |||
56 | $this->prepend('<i></i>') |
||
57 | ->defaultAttribute('style', 'width: 140px'); |
||
58 | |||
59 | return parent::render(); |
||
0 ignored issues
–
show
Bug
Compatibility
introduced
by
Loading history...
|
|||
60 | } |
||
61 | } |
||
62 |