1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AntonyThorpe\Knockout; |
4
|
|
|
|
5
|
|
|
require_once('Common.php'); |
6
|
|
|
use SilverStripe\Forms\DropdownField; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* KnockoutDropdownField |
10
|
|
|
* |
11
|
|
|
* Creates a dropdown field with an additional data-bind attribute that |
12
|
|
|
* links to a Knockout obervable |
13
|
|
|
*/ |
14
|
|
|
class KnockoutDropdownField extends DropdownField |
15
|
|
|
{ |
16
|
|
|
use \AntonyThorpe\Knockout\Common; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* bindingType |
20
|
|
|
* |
21
|
|
|
* @var string a data-bind attribute key |
22
|
|
|
* @example <select data-bind="value: spaceship, etc. ". Note: the options elements are supplied by Silverstripe |
23
|
|
|
*/ |
24
|
|
|
protected $bindingType = 'value'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* casting of variables for security purposes |
28
|
|
|
* |
29
|
|
|
* @see http://docs.silverstripe.org/en/3.1/developer_guides/security/secure_coding/ |
30
|
|
|
*/ |
31
|
|
|
protected $casting = array( |
32
|
|
|
"Observable" => "Varchar", |
33
|
|
|
"BindingType" => "Varchar", |
34
|
|
|
"OtherBindings" => "Varchar", |
35
|
|
|
"HasFocus" => "Boolean" |
36
|
|
|
); |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Constructor |
40
|
|
|
* |
41
|
|
|
* @param string $name The field name |
42
|
|
|
* @param string $title The field title |
43
|
|
|
* @param array $source An map of the dropdown items |
44
|
|
|
* @param string $value The current value |
45
|
|
|
* @param Form $form The parent form |
|
|
|
|
46
|
|
|
*/ |
47
|
|
|
public function __construct($name, $title = null, $source = array(), $value = '', $form = null) |
48
|
|
|
{ |
49
|
|
|
parent::__construct($name, $title, $source, $value, $form); |
|
|
|
|
50
|
|
|
$this->setAttribute('class', 'dropdown'); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
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