Completed
Push — develop ( 8cf0c8...02dd7c )
by Nate
03:19
created

CategoryList::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-element-lists/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-element-lists/
7
 */
8
9
namespace flipbox\craft\element\lists\fields;
10
11
use craft\fields\Categories;
12
use flipbox\craft\element\lists\ElementList;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class CategoryList extends Categories implements SortableInterface
19
{
20
    use ElementListTrait;
21
22
    /**
23
     * @inheritdoc
24
     */
25
    public function init()
26
    {
27
        parent::init();
28
29
        $this->settingsTemplate = 'element-lists/_components/fieldtypes/settings';
30
        $this->inputTemplate = 'element-lists/_components/fieldtypes/input';
31
        $this->inputJsClass = 'Craft.NestedElementIndexSelectInput';
32
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37
    public static function displayName(): string
38
    {
39
        return ElementList::t('Category List');
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    public function settingsAttributes(): array
46
    {
47
        return array_merge(
48
            parent::settingsAttributes(),
49
            [
50
                'sortable'
51
            ]
52
        );
53
    }
54
}
55