GeneralController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 73
ccs 0
cts 33
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 10 1
A getTabs() 0 13 1
A getBaseActionPath() 0 4 1
A baseVariables() 0 9 1
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 craft\helpers\UrlHelper;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class GeneralController extends AbstractSettingsController
19
{
20
    /**
21
     * The index view template path
22
     */
23
    const TEMPLATE_INDEX = AbstractSettingsController::TEMPLATE_BASE . '/general';
24
25
    /**
26
     * OrganizationIndex
27
     *
28
     * @return \yii\web\Response
29
     */
30
    public function actionIndex()
31
    {
32
        $variables = [];
33
        $this->baseVariables($variables);
34
35
        $variables['fullPageForm'] = true;
36
        $variables['tabs'] = $this->getTabs();
37
38
        return $this->renderTemplate(static::TEMPLATE_INDEX, $variables);
39
    }
40
41
    /*******************************************
42
     * TABS
43
     *******************************************/
44
45
    /**
46
     * @return array|null
47
     */
48
    protected function getTabs(): array
49
    {
50
        return [
51
            'general' => [
52
                'label' => Craft::t('organizations', 'General'),
53
                'url' => '#general'
54
            ],
55
            'layout' => [
56
                'label' => Craft::t('organizations', 'Layout'),
57
                'url' => '#layout'
58
            ]
59
        ];
60
    }
61
62
    /*******************************************
63
     * BASE PATHS
64
     *******************************************/
65
66
    /**
67
     * @return string
68
     */
69
    protected function getBaseActionPath(): string
70
    {
71
        return parent::getBaseActionPath() . '/general';
72
    }
73
74
    /*******************************************
75
     * VARIABLES
76
     *******************************************/
77
78
    /**
79
     * @inheritdoc
80
     */
81
    protected function baseVariables(array &$variables = [])
82
    {
83
        parent::baseVariables($variables);
84
85
        $variables['crumbs'][] = [
86
            'label' => Craft::t('organizations', 'General'),
87
            'url' => UrlHelper::url($variables['baseCpPath'])
88
        ];
89
    }
90
}
91