1 | <?php |
||
14 | abstract class AbstractViewController extends \flipbox\patron\cp\controllers\view\AbstractViewController |
||
15 | { |
||
16 | /** |
||
17 | * The index view template path |
||
18 | */ |
||
19 | const TEMPLATE_BASE = 'patron/_cp/provider'; |
||
20 | |||
21 | |||
22 | /******************************************* |
||
23 | * TABS |
||
24 | *******************************************/ |
||
25 | |||
26 | /** |
||
27 | * @param Provider $provider |
||
28 | * @return array |
||
29 | */ |
||
30 | protected function getTabs(Provider $provider): array |
||
31 | { |
||
32 | if ($provider->getId() === null) { |
||
33 | return []; |
||
34 | } |
||
35 | |||
36 | $baseUrl = Craft::$app->getRequest()->getSegment(1) . '/' . |
||
37 | Craft::$app->getRequest()->getSegment(2) . '/' . |
||
38 | Craft::$app->getRequest()->getSegment(3); |
||
39 | |||
40 | return [ |
||
41 | 'general' => [ |
||
42 | 'label' => Craft::t('patron', 'General'), |
||
43 | 'url' => UrlHelper::url($baseUrl . '/') |
||
44 | ], |
||
45 | 'tokens' => [ |
||
46 | 'label' => Craft::t('patron', 'Tokens'), |
||
47 | 'url' => UrlHelper::url($baseUrl . '/tokens') |
||
48 | ] |
||
49 | ]; |
||
50 | } |
||
51 | |||
52 | /******************************************* |
||
53 | * PATHS |
||
54 | *******************************************/ |
||
55 | |||
56 | /** |
||
57 | * @inheritdoc |
||
58 | */ |
||
59 | protected function getBaseCpProviderPath(): string |
||
63 | |||
64 | /** |
||
65 | * @inheritdoc |
||
66 | */ |
||
67 | protected function getBaseCpProvidersPath(): string |
||
71 | |||
72 | /** |
||
73 | * @return string |
||
74 | */ |
||
75 | protected function getBaseActionPath(): string |
||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | protected function getBaseCpPath(): string |
||
87 | |||
88 | /******************************************* |
||
89 | * VARIABLES |
||
90 | *******************************************/ |
||
91 | |||
92 | /** |
||
93 | * Set base variables used to generate template views |
||
94 | * |
||
95 | * @param array $variables |
||
96 | */ |
||
97 | protected function baseVariables(array &$variables = []) |
||
110 | |||
111 | /** |
||
112 | * @param array $variables |
||
113 | */ |
||
114 | protected function insertVariables(array &$variables) |
||
131 | |||
132 | /******************************************* |
||
133 | * UPDATE VARIABLES |
||
134 | *******************************************/ |
||
135 | |||
136 | /** |
||
137 | * @param array $variables |
||
138 | * @param Provider $provider |
||
139 | * @throws \ReflectionException |
||
140 | */ |
||
141 | protected function updateVariables(array &$variables, Provider $provider) |
||
164 | } |
||
165 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.