LayoutController::baseVariables()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 8.9713
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 1
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\modules\configuration\controllers\view;
10
11
use Craft;
12
use craft\helpers\UrlHelper as UrlHelper;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class LayoutController extends AbstractController
19
{
20
21
    /**
22
     * The index view template path
23
     */
24
    const TEMPLATE_INDEX = AbstractController::TEMPLATE_BASE . DIRECTORY_SEPARATOR . 'layout';
25
26
    /**
27
     * @return string
28
     */
29
    public function actionIndex()
30
    {
31
32
        // Empty variables for template
33
        $variables = [];
34
35
        // apply base view variables
36
        $this->baseVariables($variables);
37
38
        // Full page form in the CP
39
        $variables['fullPageForm'] = true;
40
41
        return $this->renderTemplate(static::TEMPLATE_INDEX, $variables);
42
    }
43
44
45
    /*******************************************
46
     * VARIABLES
47
     *******************************************/
48
49
    /**
50
     * @inheritdoc
51
     */
52
    protected function baseVariables(array &$variables = [])
53
    {
54
55
        // Get base variables
56
        parent::baseVariables($variables);
57
58
        // Page title
59
        $variables['title'] .= ': Default Layout';
60
61
        // Path to controller actions
62
        $variables['baseActionPath'] .= '/layout';
63
64
        // Path to CP
65
        $variables['baseCpPath'] .= '/layout';
66
67
        // Set the "Continue Editing" URL
68
        $variables['continueEditingUrl'] = $variables['baseCpPath'];
69
70
        // Breadcrumbs
71
        $variables['crumbs'][] = [
72
            'label' => Craft::t('organization', 'Layout'),
73
            'url' => UrlHelper::url($variables['baseCpPath'])
74
        ];
75
    }
76
}
77