ConfiguratorAsset   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 28
dl 0
loc 60
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 23 1
A registerAssetFiles() 0 23 2
1
<?php
2
/**
3
 * Spoon plugin for Craft CMS 3.x
4
 *
5
 * Enhance Matrix
6
 *
7
 * @link      https://angell.io
8
 * @copyright Copyright (c) 2018 Angell & Co
9
 */
10
11
namespace angellco\spoon\assetbundles;
12
13
use Craft;
14
use craft\web\AssetBundle;
15
use craft\web\assets\cp\CpAsset;
16
use craft\web\View;
17
18
/**
19
 * ConfiguratorAsset AssetBundle
20
 *
21
 * @author    Angell & Co
22
 * @package   Spoon
23
 * @since     3.0.0
24
 */
25
class ConfiguratorAsset extends AssetBundle
26
{
27
    // Public Methods
28
    // =========================================================================
29
30
    /**
31
     * Initializes the bundle.
32
     */
33
    public function init()
34
    {
35
        // define the path that your publishable resources live
36
        $this->sourcePath = "@angellco/spoon/assetbundles/dist";
37
38
        // define the dependencies
39
        $this->depends = [
40
            CpAsset::class,
41
        ];
42
43
        // define the relative path to CSS/JS files that should be registered with the page
44
        // when this asset bundle is registered
45
        $this->js = [
46
            'js/BlockTypeFieldLayoutDesigner.min.js',
47
            'js/GroupsDesigner.min.js',
48
            'js/Configurator.min.js'
49
        ];
50
51
        $this->css = [
52
            'css/main.min.css',
53
        ];
54
55
        parent::init();
56
    }
57
58
59
    /**
60
     * @inheritdoc
61
     */
62
    public function registerAssetFiles($view)
63
    {
64
        parent::registerAssetFiles($view);
65
66
        if ($view instanceof View) {
67
68
            $view->registerTranslations('app', [
69
                "Group",
70
                "Rename",
71
                "Delete",
72
                "Make required",
73
                "Make not required",
74
                "Remove",
75
                "Give your tab a name.",
76
            ]);
77
78
            $view->registerTranslations('spoon', [
79
                "Edit field layout",
80
                "Give your group a name.",
81
                "Group block types",
82
                "Block type groups deleted.",
83
                "Block type groups saved.",
84
                "There was an unknown error saving some block type groups.",
85
            ]);
86
        }
87
88
    }
89
90
}
91