Passed
Branch master (a5399b)
by Antony
01:41
created

KnockoutSwitchField::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
namespace AntonyThorpe\Knockout;
3
4
use SilverStripe\Forms\FieldList;
5
use AntonyThorpe\Knockout\KnockoutCheckboxField;
6
7
/**
8
 * Creates a {@link ConfirmedPasswordField} with an additional data-bind attribute that links to a Knockout obervable
9
 * @uses 'confirmedPassword' as the default observable
10
 */
11
class KnockoutSwitchField extends KnockoutCheckboxField
12
{
13
    /**
14
     * Constructor
15
     *
16
     * @param string $name
17
     * @param string $title
18
     * @param mixed $value The current value
19
     */
20
    public function __construct($name, $title = null, $value = '')
21
    {
22
        parent::__construct($name, $title, $value);
23
        $this->removeExtraClass('form-check-input'); // remove css from holder template
24
        $this->setTemplate('AntonyThorpe/Knockout/CheckboxField');
25
    }
26
}
27