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 | use Encore\Admin\Admin; |
||
6 | |||
7 | View Code Duplication | class RadioButton extends Radio |
|
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | protected $cascadeEvent = 'change'; |
||
13 | |||
14 | protected function addScript() |
||
15 | { |
||
16 | $script = <<<'SCRIPT' |
||
17 | $('.radio-group-toggle label').click(function() { |
||
18 | $(this).parent().children().removeClass('active'); |
||
19 | $(this).addClass('active'); |
||
20 | }); |
||
21 | SCRIPT; |
||
22 | |||
23 | Admin::script($script); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | public function render() |
||
30 | { |
||
31 | $this->addScript(); |
||
32 | |||
33 | $this->addCascadeScript(); |
||
34 | |||
35 | $this->addVariables([ |
||
36 | 'options' => $this->options, |
||
37 | 'checked' => $this->checked, |
||
38 | ]); |
||
39 | |||
40 | return parent::fieldRender(); |
||
0 ignored issues
–
show
Bug
Compatibility
introduced
by
![]() |
|||
41 | } |
||
42 | } |
||
43 |