KnockoutSwitchField   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
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 observable
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