1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the O2System Framework package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @author Steeve Andrian Salim |
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------ |
13
|
|
|
|
14
|
|
|
namespace O2System\Framework\Libraries\Ui\Components\Form\Elements\Custom; |
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------ |
17
|
|
|
|
18
|
|
|
use O2System\Framework\Libraries\Ui\Element; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class Checkbox |
22
|
|
|
* |
23
|
|
|
* @package O2System\Framework\Libraries\Ui\Components\Form |
24
|
|
|
*/ |
25
|
|
|
class Checkbox extends Element |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Checkbox::$input |
29
|
|
|
* |
30
|
|
|
* @var Input |
|
|
|
|
31
|
|
|
*/ |
32
|
|
|
public $input; |
33
|
|
|
|
34
|
|
|
// ------------------------------------------------------------------------ |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* Checkbox::__construct |
38
|
|
|
* |
39
|
|
|
* @param string|null $label |
40
|
|
|
* @param array $attributes |
41
|
|
|
*/ |
42
|
|
|
public function __construct($label = null, array $attributes = []) |
43
|
|
|
{ |
44
|
|
|
parent::__construct('label'); |
45
|
|
|
|
46
|
|
|
$this->attributes->addAttributeClass(['custom-control', 'custom-checkbox']); |
47
|
|
|
|
48
|
|
|
$attributes[ 'type' ] = 'checkbox'; |
49
|
|
|
|
50
|
|
|
$checkbox = new Input(); |
51
|
|
|
$checkbox->attributes->removeAttributeClass('form-control'); |
52
|
|
|
$checkbox->attributes->addAttributeClass('custom-control-input'); |
53
|
|
|
|
54
|
|
|
if (count($attributes)) { |
55
|
|
|
foreach ($attributes as $name => $value) { |
56
|
|
|
$checkbox->attributes->addAttribute($name, $value); |
57
|
|
|
|
58
|
|
|
if ($name === 'name') { |
59
|
|
|
$this->entity->setEntityName('input-' . $value); |
60
|
|
|
$label->entity->setEntityName('label-' . $value); |
|
|
|
|
61
|
|
|
$label->attributes->addAttribute('for', $value); |
|
|
|
|
62
|
|
|
|
63
|
|
|
if ( ! array_key_exists('id', $attributes)) { |
64
|
|
|
$checkbox->attributes->setAttributeId('input-' . $value); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
$this->input = $this->childNodes->push($checkbox); |
|
|
|
|
71
|
|
|
|
72
|
|
|
$indicator = new Element('span'); |
73
|
|
|
$indicator->attributes->addAttributeClass('custom-control-indicator'); |
74
|
|
|
$this->childNodes->push($indicator); |
75
|
|
|
|
76
|
|
|
if (isset($label)) { |
77
|
|
|
$description = new Element('span'); |
78
|
|
|
$description->attributes->addAttributeClass('custom-control-description'); |
79
|
|
|
$description->textContent->push(trim($label)); |
80
|
|
|
$this->childNodes->push($indicator); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths