Completed
Branch EDTR/master (83b47e)
by
unknown
25:37 queued 16:41
created

EspressoCoreAppAssetManager::addAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\services\assets;
4
5
use DomainException;
6
use EventEspresso\core\exceptions\InvalidDataTypeException;
7
use EventEspresso\core\exceptions\InvalidEntityException;
8
use EventEspresso\core\services\collections\DuplicateCollectionIdentifierException;
9
10
/**
11
 * EspressoEditorAssetManager
12
 * assets for EE admin editors
13
 *
14
 * @package EventEspresso\core\domain\services\assets
15
 * @author  Brent Christensen
16
 * @since   $VID:$
17
 */
18
class EspressoCoreAppAssetManager extends ReactAssetManager
19
{
20
    const JS_HANDLE_EDITOR = 'eventespresso-core-app';
21
22
    /**
23
     * @throws InvalidDataTypeException
24
     * @throws InvalidEntityException
25
     * @throws DuplicateCollectionIdentifierException
26
     * @throws DomainException
27
     */
28
    public function addAssets()
29
    {
30
        parent::addAssets();
31
        $this->registerJavascript();
32
    }
33
34
35
    /**
36
     * Register javascript assets
37
     *
38
     * @throws InvalidDataTypeException
39
     * @throws InvalidEntityException
40
     * @throws DuplicateCollectionIdentifierException
41
     * @throws DomainException
42
     */
43 View Code Duplication
    private function registerJavascript()
44
    {
45
        $this->addJs(
46
            EspressoCoreAppAssetManager::JS_HANDLE_EDITOR,
47
            [
48
                ReactAssetManager::JS_HANDLE_REACT,
49
                ReactAssetManager::JS_HANDLE_REACT_DOM,
50
                CoreAssetManager::JS_HANDLE_JS_CORE,
51
                'wp-components',
52
                'wp-i18n',
53
                'wp-keycodes',
54
                'wp-url',
55
            ]
56
        )->setRequiresTranslation();
57
    }
58
}
59