1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AntonyThorpe\Knockout; |
4
|
|
|
|
5
|
|
|
require_once('Common.php'); |
6
|
|
|
use SilverStripe\Forms\EmailField; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* KnockoutEmailField |
10
|
|
|
* |
11
|
|
|
* Creates a {@link EmailField} with an additional data-bind attribute that links to a Knockout obervable |
12
|
|
|
*/ |
13
|
|
|
class KnockoutEmailField extends EmailField |
14
|
|
|
{ |
15
|
|
|
|
16
|
|
|
use \AntonyThorpe\Knockout\Common; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* bindingType |
20
|
|
|
* |
21
|
|
|
* KnockoutEmailField needs either 'value' or 'textInput' as a key for the 'data-bind' HTML attribute. |
22
|
|
|
* Default to textInput for live updates |
23
|
|
|
* |
24
|
|
|
* @var string data-bind attribute key |
25
|
|
|
* @example data-bind="textInput: email" - the binding type is: textInput. |
26
|
|
|
*/ |
27
|
|
|
protected $bindingType = "textInput"; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* casting of variables for security purposes |
31
|
|
|
* |
32
|
|
|
* @see http://docs.silverstripe.org/en/3.1/developer_guides/security/secure_coding/ |
33
|
|
|
*/ |
34
|
|
|
protected $casting = array( |
35
|
|
|
"Observable" => "Varchar", |
36
|
|
|
"BindingType" => "Varchar", |
37
|
|
|
"OtherBindings" => "Varchar", |
38
|
|
|
"HasFocus" => "Boolean" |
39
|
|
|
); |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Constructor |
43
|
|
|
* |
44
|
|
|
* @param string $name |
45
|
|
|
* @param null|string $title |
46
|
|
|
* @param string $value |
47
|
|
|
* @param null|int $maxLength |
48
|
|
|
* @param null|Form $form |
|
|
|
|
49
|
|
|
*/ |
50
|
|
|
public function __construct($name, $title = null, $value = '', $maxLength = null, $form = null) |
51
|
|
|
{ |
52
|
|
|
parent::__construct($name, $title, $value, $maxLength, $form); |
53
|
|
|
$this->setTemplate('AntonyThorpe\Knockout\KnockoutTextField'); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
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