Completed
Push — develop ( fcce06...87d9a9 )
by Nate
02:07
created

AbstractSettingsController::getBaseCpPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
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\organizations\cp\controllers\settings\view;
10
11
use Craft;
12
use flipbox\craft\ember\helpers\UrlHelper;
13
use flipbox\organizations\cp\controllers\view\AbstractController;
14
use flipbox\organizations\cp\Cp as CpModule;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 *
20
 * @property CpModule $module
21
 */
22
abstract class AbstractSettingsController extends AbstractController
23
{
24
    /**
25
     * The index view template path
26
     */
27
    const TEMPLATE_BASE = parent::TEMPLATE_BASE . '/settings';
28
29
    /*******************************************
30
     * BASE PATHS
31
     *******************************************/
32
33
    /**
34
     * @return string
35
     */
36
    protected function getBaseActionPath(): string
37
    {
38
        return parent::getBaseActionPath() . '/settings';
39
    }
40
41
    /**
42
     * @return string
43
     */
44
    protected function getBaseCpPath(): string
45
    {
46
        return parent::getBaseCpPath() . '/settings';
47
    }
48
49
    /*******************************************
50
     * VARIABLES
51
     *******************************************/
52
53
    /**
54
     * @inheritdoc
55
     */
56
    protected function baseVariables(array &$variables = [])
57
    {
58
        parent::baseVariables($variables);
59
60
        // Select our sub-nav
61
        if (!$activeSubNav = Craft::$app->getRequest()->getSegment(3)) {
62
            $activeSubNav = 'general';
63
        }
64
        $variables['selectedSubnavItem'] = 'organizations.' . $activeSubNav;
65
66
        $title = Craft::t('organizations', "Settings");
67
        $variables['title'] = Craft::t('organizations', "Organization") . ' ' . $title;
68
69
        // Breadcrumbs
70
        $variables['crumbs'][] = [
71
            'label' => $title,
72
            'url' => UrlHelper::url($this->getBaseCpPath())
73
        ];
74
    }
75
}
76