AbstractController::getBaseCpPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/organization/license
6
 * @link       https://www.flipboxfactory.com/software/organization/
7
 */
8
9
namespace flipbox\organization\controllers\view;
10
11
use Craft;
12
use flipbox\organization\controllers\AbstractController as BaseViewController;
13
use flipbox\organization\Organization as OrganizationPlugin;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
abstract class AbstractController extends BaseViewController
20
{
21
22
    /**
23
     * The index view template path
24
     */
25
    const TEMPLATE_BASE = 'organization' . DIRECTORY_SEPARATOR . '_cp';
26
27
    /*******************************************
28
     * VARIABLES
29
     *******************************************/
30
31
    /**
32
     * @return string
33
     */
34
    protected function getBaseActionPath(): string
35
    {
36
        return OrganizationPlugin::getInstance()->getUniqueId();
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    protected function getBaseCpPath(): string
43
    {
44
        return OrganizationPlugin::getInstance()->getUniqueId();
45
    }
46
47
    /**
48
     * @inheritdoc
49
     */
50
    protected function baseVariables(array &$variables = [])
51
    {
52
53
        $module = OrganizationPlugin::getInstance();
54
55
        // Settings
56
        $variables['settings'] = $module->getSettings();
57
58
        // Page title
59
        $variables['title'] = Craft::t('organization', "Organizations");
60
61
        // Selected tab
62
        $variables['selectedTab'] = '';
63
64
        // Path to controller actions
65
        $variables['baseActionPath'] = $this->getBaseActionPath();
66
67
        // Path to CP
68
        $variables['baseCpPath'] = $this->getBaseCpPath();
69
70
        // Set the "Continue Editing" URL
71
        $variables['continueEditingUrl'] = $this->getBaseCpPath();
72
    }
73
}
74