Moo_EditableFieldCheckbox   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 40%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 31
ccs 2
cts 5
cp 0.4
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFieldConfiguration() 0 6 1
A initFormField() 0 4 1
1
<?php
2
3
/**
4
 * Moo_EditableFieldCheckbox is an object representing a checkbox created by CMS admin.
5
 *
6
 * @package editablefield
7
 *
8
 * @author  Mohamed Alsharaf <[email protected]>
9
 */
10
class Moo_EditableFieldCheckbox extends Moo_EditableField
11
{
12
    private static $singular_name = 'Checkbox Field';
13
    private static $plural_name   = 'Checkboxes';
14
15
    /**
16
     * List of allowed custom settings fields.
17
     *
18
     * @var array
19
     */
20
    protected $customSettingsFields = [
21
        'Default',
22
    ];
23
24
    /**
25
     * Get extra configuration fields.
26
     *
27
     * @return array
28
     */
29
    public function getFieldConfiguration()
30
    {
31
        return [
32
            new CheckboxField($this->getSettingName('Default'), _t('Moo_EditableField.CHECKEDBYDEFAULT', 'Checked by Default?'), $this->getSetting('Default')),
33
        ];
34
    }
35
36 1
    protected function initFormField()
37
    {
38 1
        return new CheckboxField($this->Name, $this->Title, $this->getSetting('Default'));
39
    }
40
}
41