FieldManipulatorAsset::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 22
rs 9.9666
cc 1
nc 1
nop 0
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\assets\matrix\MatrixAsset;
17
use craft\web\View;
18
19
/**
20
 * FieldManipulatorAsset AssetBundle
21
 *
22
 * @author    Angell & Co
23
 * @package   Spoon
24
 * @since     3.0.0
25
 */
26
class FieldManipulatorAsset extends AssetBundle
27
{
28
    // Public Methods
29
    // =========================================================================
30
31
    /**
32
     * Initializes the bundle.
33
     */
34
    public function init()
35
    {
36
        // define the path that your publishable resources live
37
        $this->sourcePath = "@angellco/spoon/assetbundles/dist";
38
39
        // define the dependencies
40
        $this->depends = [
41
            CpAsset::class,
42
            MatrixAsset::class
43
        ];
44
45
        // define the relative path to CSS/JS files that should be registered with the page
46
        // when this asset bundle is registered
47
        $this->js = [
48
            'js/FieldManipulator.min.js',
49
        ];
50
51
        $this->css = [
52
            'css/main.min.css',
53
        ];
54
55
        parent::init();
56
    }
57
58
    /**
59
     * @inheritdoc
60
     */
61
    public function registerAssetFiles($view)
62
    {
63
64
        parent::registerAssetFiles($view);
65
66
        if ($view instanceof View) {
67
68
            $view->registerTranslations('app', [
69
                "Add a block",
70
            ]);
71
72
        }
73
74
    }
75
76
}
77