1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @copyright Copyright (c) Flipbox Digital Limited |
5
|
|
|
* @license https://flipboxfactory.com/software/hubspot/license |
6
|
|
|
* @link https://www.flipboxfactory.com/software/hubspot/ |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace flipbox\craft\hubspot\cp\controllers\settings\view; |
10
|
|
|
|
11
|
|
|
use flipbox\craft\ember\helpers\UrlHelper; |
12
|
|
|
use flipbox\craft\hubspot\cp\Cp as CpModule; |
13
|
|
|
use flipbox\craft\hubspot\HubSpot; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @author Flipbox Factory <[email protected]> |
17
|
|
|
* @since 1.0.0 |
18
|
|
|
* |
19
|
|
|
* @property CpModule $module |
20
|
|
|
*/ |
21
|
|
|
abstract class AbstractController extends \flipbox\craft\hubspot\cp\controllers\view\AbstractController |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* The index view template path |
25
|
|
|
*/ |
26
|
|
|
const TEMPLATE_BASE = parent::TEMPLATE_BASE . '/settings'; |
27
|
|
|
|
28
|
|
|
/******************************************* |
29
|
|
|
* BASE PATHS |
30
|
|
|
*******************************************/ |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
|
|
protected function getBaseActionPath(): string |
36
|
|
|
{ |
37
|
|
|
return parent::getBaseActionPath() . '/settings'; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return string |
42
|
|
|
*/ |
43
|
|
|
protected function getBaseCpPath(): string |
44
|
|
|
{ |
45
|
|
|
return parent::getBaseCpPath() . '/settings'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param string $endpoint |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
protected function getBaseContinueEditingUrl(string $endpoint = ''): string |
53
|
|
|
{ |
54
|
|
|
return $this->getBaseCpPath() . $endpoint; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/******************************************* |
58
|
|
|
* VARIABLES |
59
|
|
|
*******************************************/ |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @inheritdoc |
63
|
|
|
*/ |
64
|
|
|
protected function baseVariables(array &$variables = []) |
65
|
|
|
{ |
66
|
|
|
parent::baseVariables($variables); |
67
|
|
|
|
68
|
|
|
$title = HubSpot::t("Settings"); |
69
|
|
|
$variables['title'] .= ': ' . $title; |
70
|
|
|
|
71
|
|
|
// Breadcrumbs |
72
|
|
|
$variables['crumbs'][] = [ |
73
|
|
|
'label' => $title, |
74
|
|
|
'url' => UrlHelper::url(HubSpot::getInstance()->getUniqueId()) |
75
|
|
|
]; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/******************************************* |
79
|
|
|
* UPSERT VARIABLES |
80
|
|
|
*******************************************/ |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param array $variables |
84
|
|
|
*/ |
85
|
|
|
protected function insertVariables(array &$variables) |
86
|
|
|
{ |
87
|
|
|
$this->baseVariables($variables); |
88
|
|
|
$variables['continueEditingUrl'] = $this->getBaseContinueEditingUrl('/{id}'); |
89
|
|
|
$variables['title'] .= ' - ' . HubSpot::t('New'); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|