1 | <?php |
||
20 | class UserTypesController extends AbstractSettingsController |
||
21 | { |
||
22 | /** |
||
23 | * The index view template path |
||
24 | */ |
||
25 | const TEMPLATE_INDEX = AbstractSettingsController::TEMPLATE_BASE . '/userTypes'; |
||
26 | |||
27 | /** |
||
28 | * The insert/update view template path |
||
29 | */ |
||
30 | const TEMPLATE_UPSERT = self::TEMPLATE_INDEX . '/upsert'; |
||
31 | |||
32 | /** |
||
33 | * @return Response |
||
34 | */ |
||
35 | public function actionIndex() |
||
44 | |||
45 | /** |
||
46 | * @param null $identifier |
||
47 | * @param UserType|null $userType |
||
48 | * @return Response |
||
49 | * @throws \flipbox\craft\ember\exceptions\RecordNotFoundException |
||
50 | */ |
||
51 | public function actionUpsert($identifier = null, UserType $userType = null) |
||
73 | |||
74 | /******************************************* |
||
75 | * BASE PATHS |
||
76 | *******************************************/ |
||
77 | |||
78 | /** |
||
79 | * @return string |
||
80 | */ |
||
81 | protected function getBaseActionPath(): string |
||
85 | |||
86 | /** |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function getBaseCpPath(): string |
||
93 | |||
94 | /******************************************* |
||
95 | * INSERT VARIABLES |
||
96 | *******************************************/ |
||
97 | |||
98 | /** |
||
99 | * @param array $variables |
||
100 | */ |
||
101 | protected function insertVariables(array &$variables) |
||
106 | |||
107 | /******************************************* |
||
108 | * UPDATE VARIABLES |
||
109 | *******************************************/ |
||
110 | |||
111 | /** |
||
112 | * @param array $variables |
||
113 | * @param UserType $userType |
||
114 | */ |
||
115 | protected function updateVariables(array &$variables, UserType $userType) |
||
126 | |||
127 | /******************************************* |
||
128 | * VARIABLES |
||
129 | *******************************************/ |
||
130 | |||
131 | /** |
||
132 | * @inheritdoc |
||
133 | */ |
||
134 | protected function baseVariables(array &$variables = []) |
||
145 | } |
||
146 |
If a variable is not always an object, we recommend to add an additional type check to ensure your method call is safe: