Completed
Push — master ( 4ac545...fafd4b )
by Nate
03:35
created

Ember::init()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 9.4285
cc 2
eloc 5
nc 1
nop 0
crap 6
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/ember/blob/master/LICENSE
6
 * @link       https://github.com/flipbox/ember
7
 */
8
9
namespace flipbox\ember;
10
11
use craft\events\RegisterTemplateRootsEvent;
12
use craft\web\View;
13
use yii\base\Event;
14
use yii\base\Module;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
class Ember extends Module
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    public function init()
26
    {
27
        parent::init();
28
29
        // Base template directory
30
        Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {
31
            if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) {
32
                $e->roots[$this->uniqueId] = $baseDir;
33
            }
34
        });
35
    }
36
}
37