1 | <?php |
||
10 | class DrupalKernelPlaceholder |
||
11 | { |
||
12 | /** |
||
13 | * Version-related implementation of @BeforeFeature hook for TqContext. |
||
14 | * |
||
15 | * @param BeforeFeatureScope $scope |
||
16 | * |
||
17 | * @see TqContext::beforeFeature() |
||
18 | */ |
||
19 | public static function beforeFeature(BeforeFeatureScope $scope) |
||
23 | |||
24 | /** |
||
25 | * @param string $string |
||
26 | * @param array $arguments |
||
27 | * @param array $options |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | public static function t($string, array $arguments = [], array $options = []) |
||
35 | |||
36 | /** |
||
37 | * @param string $string |
||
38 | * @param array $arguments |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public static function formatString($string, array $arguments = []) |
||
46 | |||
47 | /** |
||
48 | * @return string[] |
||
49 | */ |
||
50 | public static function arg() |
||
54 | |||
55 | /** |
||
56 | * @param string $text |
||
57 | * Input text. |
||
58 | * @param array $data |
||
59 | * Data for replacements. |
||
60 | * @param array $options |
||
61 | * Replacement configuration. |
||
62 | * |
||
63 | * @return string |
||
64 | * Processed text. |
||
65 | */ |
||
66 | public static function tokenReplace($text, array $data = [], array $options = []) |
||
70 | |||
71 | /** |
||
72 | * @param mixed $data |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public static function jsonEncode($data) |
||
77 | { |
||
78 | return self::requireContext(__FUNCTION__, func_get_args()); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return object |
||
83 | */ |
||
84 | public static function getCurrentUser() |
||
85 | { |
||
86 | return self::requireContext(__FUNCTION__, func_get_args()); |
||
87 | } |
||
88 | |||
89 | public static function setCurrentUser($user) |
||
93 | |||
94 | public static function setCurrentPath($path) |
||
98 | |||
99 | /** |
||
100 | * Locate user ID by its name. |
||
101 | * |
||
102 | * @param string $username |
||
103 | * |
||
104 | * @return int |
||
105 | */ |
||
106 | public static function getUidByName($username) |
||
110 | |||
111 | /** |
||
112 | * @param int $user_id |
||
113 | */ |
||
114 | public static function deleteUser($user_id) |
||
118 | |||
119 | /** |
||
120 | * @param string $table |
||
121 | * @param string $alias |
||
122 | * @param array $options |
||
123 | * |
||
124 | * @return object |
||
125 | */ |
||
126 | public static function selectQuery($table, $alias = null, array $options = []) |
||
130 | |||
131 | /** |
||
132 | * @param string $entityType |
||
133 | * @param string $bundle |
||
134 | * |
||
135 | * @return array[] |
||
136 | * An associative array where key - machine-name of a field and |
||
137 | * value - an array with two keys: "label" and "required". |
||
138 | */ |
||
139 | public static function getFieldDefinitions($entityType, $bundle) |
||
143 | |||
144 | /** |
||
145 | * Get information about database connections. |
||
146 | * |
||
147 | * Impossible to use $GLOBALS['databases'] in Drupal 8 since {@link https://www.drupal.org/node/2176621}. |
||
148 | * |
||
149 | * @param string $connection |
||
150 | * Connection name. |
||
151 | * |
||
152 | * @return array[] |
||
153 | */ |
||
154 | public static function getDatabaseConnectionInfo($connection) |
||
158 | |||
159 | /** |
||
160 | * @param string $entityType |
||
161 | * The type of entity. |
||
162 | * @param array $values |
||
163 | * Values for entity creation. |
||
164 | * |
||
165 | * @return string[] |
||
166 | * List with three items in order: entity ID, type and bundle. |
||
167 | */ |
||
168 | public static function entityCreate($entityType, array $values) |
||
172 | |||
173 | /** |
||
174 | * @param string $entityType |
||
175 | * The type of entity. |
||
176 | * @param int $id |
||
177 | * |
||
178 | * @return object|null |
||
179 | */ |
||
180 | public static function entityLoad($entityType, $id) |
||
184 | |||
185 | /** |
||
186 | * @param object $entity |
||
187 | * @param string $fieldName |
||
188 | * |
||
189 | * @return bool |
||
190 | */ |
||
191 | public static function entityHasField($entity, $fieldName) |
||
195 | |||
196 | /** |
||
197 | * @param object $entity |
||
198 | * @param string $fieldName |
||
199 | * |
||
200 | * @return mixed |
||
201 | */ |
||
202 | public static function entityFieldValue($entity, $fieldName) |
||
206 | |||
207 | /** |
||
208 | * Switching the mail system. |
||
209 | * |
||
210 | * @param bool $useTesting |
||
211 | * Whether testing or standard mail system should be used. |
||
212 | */ |
||
213 | public static function switchMailSystem($useTesting) |
||
217 | |||
218 | /** |
||
219 | * Get a list of emails, collected by testing mail system. |
||
220 | * |
||
221 | * @return array |
||
222 | */ |
||
223 | public static function getEmailMessages() |
||
227 | |||
228 | /** |
||
229 | * Check existence of the content type by its machine name or title. |
||
230 | * |
||
231 | * @param string $contentType |
||
232 | * Machine name or title of the content type. |
||
233 | * |
||
234 | * @return string |
||
235 | * Machine name. |
||
236 | */ |
||
237 | public static function getContentTypeName($contentType) |
||
241 | |||
242 | /** |
||
243 | * @param int $count |
||
244 | * Number of entries to fetch. |
||
245 | * @param string[] $types |
||
246 | * Any set of Watchdog error types. |
||
247 | * |
||
248 | * @return array[] |
||
249 | */ |
||
250 | public static function getWatchdogStackTrace($count = 10, array $types = ['php']) |
||
259 | |||
260 | /** |
||
261 | * @param string $file |
||
262 | * Existing file from "src/JavaScript" without ".js" extension. |
||
263 | * @param bool $delete |
||
264 | * Whether injection should be deleted. |
||
265 | */ |
||
266 | final public static function injectCustomJavascript($file, $delete = false) |
||
310 | |||
311 | /** |
||
312 | * Require method execution from context. |
||
313 | * |
||
314 | * @param string $method |
||
315 | * The name of method. |
||
316 | * @param array $arguments |
||
317 | * Method's arguments. |
||
318 | * |
||
319 | * @return mixed |
||
320 | */ |
||
321 | private static function requireContext($method, array $arguments) |
||
331 | } |
||
332 |