1 | <?php |
||
2 | |||
3 | namespace SilverStripe\UserForms\FormField; |
||
4 | |||
5 | use SilverStripe\Forms\CheckboxSetField; |
||
6 | |||
7 | /** |
||
8 | * @package userforms |
||
9 | */ |
||
10 | class UserFormsCheckboxSetField extends CheckboxSetField |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * jQuery validate requires that the value of the option does not contain |
||
15 | * the actual value of the input. |
||
16 | * |
||
17 | * @return ArrayList |
||
0 ignored issues
–
show
|
|||
18 | */ |
||
19 | public function getOptions() |
||
20 | { |
||
21 | $options = parent::getOptions(); |
||
22 | |||
23 | foreach ($options as $option) { |
||
24 | $option->Name = "{$this->name}[]"; |
||
25 | } |
||
26 | |||
27 | return $options; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @inheritdoc |
||
32 | * |
||
33 | * @param Validator $validator |
||
0 ignored issues
–
show
The type
SilverStripe\UserForms\FormField\Validator was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function validate($validator) |
||
38 | { |
||
39 | // get the previous values (could contain comma-delimited list) |
||
40 | |||
41 | $previous = $value = $this->Value(); |
||
42 | |||
43 | if (is_string($value) && strstr($value, ",")) { |
||
44 | $value = explode(",", $value); |
||
45 | } |
||
46 | |||
47 | // set the value as an array for parent validation |
||
48 | |||
49 | $this->setValue($value); |
||
50 | |||
51 | $validated = parent::validate($validator); |
||
52 | |||
53 | // restore previous value after validation |
||
54 | |||
55 | $this->setValue($previous); |
||
56 | |||
57 | return $validated; |
||
58 | } |
||
59 | } |
||
60 |
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