KnockoutForm::getSubmit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AntonyThorpe\Knockout;
4
5
/**
6
 * Adds a submit binding handlier to the form element to capture click/enter events
7
 * Delivers the form element to the javascript function
8
 */
9
class KnockoutForm extends \SilverStripe\Forms\Form
10
{
11
12
    /**
13
     * $submit
14
     *
15
     * @var string the javascript function to run upon a click/enter event
16
     */
17
    protected $submit;
18
19
    /**
20
     * casting of variables for security purposes
21
     *
22
     * @see http://docs.silverstripe.org/en/3.1/developer_guides/security/secure_coding/
23
     */
24
    protected $casting = array(
25
        "Submit" => "Varchar"
26
    );
27
28
    /**
29
     * setSubmit
30
     *
31
     * @param string $input The javascript function called upon form submit
32
     * @return $this
33
     */
34
    public function setSubmit($input)
35
    {
36
        $this->submit = (string)$input;
37
        return $this;
38
    }
39
40
    /**
41
     * getSubmit
42
     *
43
     * @return string
44
     */
45
    public function getSubmit()
46
    {
47
        return $this->submit;
48
    }
49
}
50