Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\config_translation;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Language\LanguageInterface;
|
Chris@0
|
6 use Drupal\Core\Routing\RouteMatchInterface;
|
Chris@0
|
7 use Symfony\Component\Routing\RouteCollection;
|
Chris@0
|
8
|
Chris@0
|
9 /**
|
Chris@0
|
10 * Defines an interface for configuration mapper.
|
Chris@0
|
11 */
|
Chris@0
|
12 interface ConfigMapperInterface {
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Returns title of this translation page.
|
Chris@0
|
16 *
|
Chris@0
|
17 * @return string
|
Chris@0
|
18 * The page title.
|
Chris@0
|
19 */
|
Chris@0
|
20 public function getTitle();
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * Sets the route collection.
|
Chris@0
|
24 *
|
Chris@0
|
25 * @param \Symfony\Component\Routing\RouteCollection $collection
|
Chris@0
|
26 * The route collection.
|
Chris@0
|
27 */
|
Chris@0
|
28 public function setRouteCollection(RouteCollection $collection);
|
Chris@0
|
29
|
Chris@0
|
30 /**
|
Chris@0
|
31 * Returns the name of the base route the mapper is attached to.
|
Chris@0
|
32 *
|
Chris@0
|
33 * @return string
|
Chris@0
|
34 * The name of the base route the mapper is attached to.
|
Chris@0
|
35 */
|
Chris@0
|
36 public function getBaseRouteName();
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Returns the route parameters for the base route the mapper is attached to.
|
Chris@0
|
40 *
|
Chris@0
|
41 * @return array
|
Chris@0
|
42 */
|
Chris@0
|
43 public function getBaseRouteParameters();
|
Chris@0
|
44
|
Chris@0
|
45 /**
|
Chris@0
|
46 * Returns the base route object the mapper is attached to.
|
Chris@0
|
47 *
|
Chris@0
|
48 * @return \Symfony\Component\Routing\Route
|
Chris@0
|
49 * The base route object the mapper is attached to.
|
Chris@0
|
50 */
|
Chris@0
|
51 public function getBaseRoute();
|
Chris@0
|
52
|
Chris@0
|
53 /**
|
Chris@0
|
54 * Returns a processed path for the base route the mapper is attached to.
|
Chris@0
|
55 *
|
Chris@0
|
56 * @return string
|
Chris@0
|
57 * Processed path with placeholders replaced.
|
Chris@0
|
58 */
|
Chris@0
|
59 public function getBasePath();
|
Chris@0
|
60
|
Chris@0
|
61 /**
|
Chris@0
|
62 * Returns route name for the translation overview route.
|
Chris@0
|
63 *
|
Chris@0
|
64 * @return string
|
Chris@0
|
65 * Route name for the mapper.
|
Chris@0
|
66 */
|
Chris@0
|
67 public function getOverviewRouteName();
|
Chris@0
|
68
|
Chris@0
|
69 /**
|
Chris@0
|
70 * Returns the route parameters for the translation overview route.
|
Chris@0
|
71 *
|
Chris@0
|
72 * @return array
|
Chris@0
|
73 */
|
Chris@0
|
74 public function getOverviewRouteParameters();
|
Chris@0
|
75
|
Chris@0
|
76 /**
|
Chris@0
|
77 * Returns the route object for a translation overview route.
|
Chris@0
|
78 *
|
Chris@0
|
79 * @return \Symfony\Component\Routing\Route
|
Chris@0
|
80 * The route object for the translation page.
|
Chris@0
|
81 */
|
Chris@0
|
82 public function getOverviewRoute();
|
Chris@0
|
83
|
Chris@0
|
84 /**
|
Chris@0
|
85 * Returns a processed path for the translation overview route.
|
Chris@0
|
86 *
|
Chris@0
|
87 * @return string
|
Chris@0
|
88 * Processed path with placeholders replaced.
|
Chris@0
|
89 */
|
Chris@0
|
90 public function getOverviewPath();
|
Chris@0
|
91
|
Chris@0
|
92 /**
|
Chris@0
|
93 * Returns route name for the translation add form route.
|
Chris@0
|
94 *
|
Chris@0
|
95 * @return string
|
Chris@0
|
96 * Route name for the mapper.
|
Chris@0
|
97 */
|
Chris@0
|
98 public function getAddRouteName();
|
Chris@0
|
99
|
Chris@0
|
100 /**
|
Chris@0
|
101 * Returns the route parameters for the translation add form route.
|
Chris@0
|
102 *
|
Chris@0
|
103 * @return array
|
Chris@0
|
104 */
|
Chris@0
|
105 public function getAddRouteParameters();
|
Chris@0
|
106
|
Chris@0
|
107 /**
|
Chris@0
|
108 * Returns the route object for a translation add form route.
|
Chris@0
|
109 *
|
Chris@0
|
110 * @return \Symfony\Component\Routing\Route
|
Chris@0
|
111 * The route object for the translation page.
|
Chris@0
|
112 */
|
Chris@0
|
113 public function getAddRoute();
|
Chris@0
|
114
|
Chris@0
|
115 /**
|
Chris@0
|
116 * Returns route name for the translation edit form route.
|
Chris@0
|
117 *
|
Chris@0
|
118 * @return string
|
Chris@0
|
119 * Route name for the mapper.
|
Chris@0
|
120 */
|
Chris@0
|
121 public function getEditRouteName();
|
Chris@0
|
122
|
Chris@0
|
123 /**
|
Chris@0
|
124 * Returns the route parameters for the translation edit form route.
|
Chris@0
|
125 *
|
Chris@0
|
126 * @return array
|
Chris@0
|
127 */
|
Chris@0
|
128 public function getEditRouteParameters();
|
Chris@0
|
129
|
Chris@0
|
130 /**
|
Chris@0
|
131 * Returns the route object for a translation edit form route.
|
Chris@0
|
132 *
|
Chris@0
|
133 * @return \Symfony\Component\Routing\Route
|
Chris@0
|
134 * The route object for the translation page.
|
Chris@0
|
135 */
|
Chris@0
|
136 public function getEditRoute();
|
Chris@0
|
137
|
Chris@0
|
138 /**
|
Chris@0
|
139 * Returns route name for the translation deletion route.
|
Chris@0
|
140 *
|
Chris@0
|
141 * @return string
|
Chris@0
|
142 * Route name for the mapper.
|
Chris@0
|
143 */
|
Chris@0
|
144 public function getDeleteRouteName();
|
Chris@0
|
145
|
Chris@0
|
146 /**
|
Chris@0
|
147 * Returns the route parameters for the translation deletion route.
|
Chris@0
|
148 *
|
Chris@0
|
149 * @return array
|
Chris@0
|
150 */
|
Chris@0
|
151 public function getDeleteRouteParameters();
|
Chris@0
|
152
|
Chris@0
|
153 /**
|
Chris@0
|
154 * Returns the route object for the translation deletion route.
|
Chris@0
|
155 *
|
Chris@0
|
156 * @return \Symfony\Component\Routing\Route
|
Chris@0
|
157 * The route object for the translation page.
|
Chris@0
|
158 */
|
Chris@0
|
159 public function getDeleteRoute();
|
Chris@0
|
160
|
Chris@0
|
161 /**
|
Chris@0
|
162 * Returns an array of configuration names for the mapper.
|
Chris@0
|
163 *
|
Chris@0
|
164 * @return array
|
Chris@0
|
165 * An array of configuration names for the mapper.
|
Chris@0
|
166 */
|
Chris@0
|
167 public function getConfigNames();
|
Chris@0
|
168
|
Chris@0
|
169 /**
|
Chris@0
|
170 * Adds the given configuration name to the list of names.
|
Chris@0
|
171 *
|
Chris@0
|
172 * Note that it is the responsibility of the calling code to ensure that the
|
Chris@0
|
173 * configuration exists.
|
Chris@0
|
174 *
|
Chris@0
|
175 * @param string $name
|
Chris@0
|
176 * Configuration name.
|
Chris@0
|
177 */
|
Chris@0
|
178 public function addConfigName($name);
|
Chris@0
|
179
|
Chris@0
|
180 /**
|
Chris@0
|
181 * Returns the weight of the mapper.
|
Chris@0
|
182 *
|
Chris@0
|
183 * @return int
|
Chris@0
|
184 * The weight of the mapper.
|
Chris@0
|
185 */
|
Chris@0
|
186 public function getWeight();
|
Chris@0
|
187
|
Chris@0
|
188 /**
|
Chris@0
|
189 * Returns an array with all configuration data.
|
Chris@0
|
190 *
|
Chris@0
|
191 * @return array
|
Chris@0
|
192 * Configuration data keyed by configuration names.
|
Chris@0
|
193 */
|
Chris@0
|
194 public function getConfigData();
|
Chris@0
|
195
|
Chris@0
|
196 /**
|
Chris@0
|
197 * Returns the original language code of the configuration.
|
Chris@0
|
198 *
|
Chris@0
|
199 * @throws \RuntimeException
|
Chris@0
|
200 * Throws an exception if the language codes in the config files don't
|
Chris@0
|
201 * match.
|
Chris@0
|
202 */
|
Chris@0
|
203 public function getLangcode();
|
Chris@0
|
204
|
Chris@0
|
205 /**
|
Chris@0
|
206 * Returns the language code of a configuration object given its name.
|
Chris@0
|
207 *
|
Chris@0
|
208 * @param string $config_name
|
Chris@0
|
209 * The name of the configuration object.
|
Chris@0
|
210 *
|
Chris@0
|
211 * @return string
|
Chris@0
|
212 * The language code of the configuration object.
|
Chris@0
|
213 */
|
Chris@0
|
214 public function getLangcodeFromConfig($config_name);
|
Chris@0
|
215
|
Chris@0
|
216 /**
|
Chris@0
|
217 * Sets the original language code.
|
Chris@0
|
218 *
|
Chris@0
|
219 * @param string $langcode
|
Chris@0
|
220 * The langcode.
|
Chris@0
|
221 *
|
Chris@0
|
222 * @return $this
|
Chris@0
|
223 */
|
Chris@0
|
224 public function setLangcode($langcode);
|
Chris@0
|
225
|
Chris@0
|
226 /**
|
Chris@0
|
227 * Returns the name of the type of data the mapper encapsulates.
|
Chris@0
|
228 *
|
Chris@0
|
229 * @return string
|
Chris@0
|
230 * The name of the type of data the mapper encapsulates.
|
Chris@0
|
231 */
|
Chris@0
|
232 public function getTypeName();
|
Chris@0
|
233
|
Chris@0
|
234 /**
|
Chris@0
|
235 * Provides an array of information to build a list of operation links.
|
Chris@0
|
236 *
|
Chris@0
|
237 * @return array
|
Chris@0
|
238 * An associative array of operation link data for this list, keyed by
|
Chris@0
|
239 * operation name, containing the following key-value pairs:
|
Chris@0
|
240 * - title: The localized title of the operation.
|
Chris@0
|
241 * - href: The path for the operation.
|
Chris@0
|
242 * - options: An array of URL options for the path.
|
Chris@0
|
243 * - weight: The weight of this operation.
|
Chris@0
|
244 */
|
Chris@0
|
245 public function getOperations();
|
Chris@0
|
246
|
Chris@0
|
247 /**
|
Chris@0
|
248 * Returns the label of the type of data the mapper encapsulates.
|
Chris@0
|
249 *
|
Chris@0
|
250 * @return string
|
Chris@0
|
251 * The label of the type of data the mapper encapsulates.
|
Chris@0
|
252 */
|
Chris@0
|
253 public function getTypeLabel();
|
Chris@0
|
254
|
Chris@0
|
255 /**
|
Chris@0
|
256 * Checks that all pieces of this configuration mapper have a schema.
|
Chris@0
|
257 *
|
Chris@0
|
258 * @return bool
|
Chris@0
|
259 * TRUE if all of the elements have schema, FALSE otherwise.
|
Chris@0
|
260 */
|
Chris@0
|
261 public function hasSchema();
|
Chris@0
|
262
|
Chris@0
|
263 /**
|
Chris@0
|
264 * Checks if pieces of this configuration mapper have translatables.
|
Chris@0
|
265 *
|
Chris@0
|
266 * @return bool
|
Chris@0
|
267 * TRUE if at least one of the configuration elements has translatables,
|
Chris@0
|
268 * FALSE otherwise.
|
Chris@0
|
269 */
|
Chris@0
|
270 public function hasTranslatable();
|
Chris@0
|
271
|
Chris@0
|
272 /**
|
Chris@0
|
273 * Checks whether there is already a translation for this mapper.
|
Chris@0
|
274 *
|
Chris@0
|
275 * @param \Drupal\Core\Language\LanguageInterface $language
|
Chris@0
|
276 * A language object.
|
Chris@0
|
277 *
|
Chris@0
|
278 * @return bool
|
Chris@0
|
279 * TRUE if any of the configuration elements have a translation in the
|
Chris@0
|
280 * given language, FALSE otherwise.
|
Chris@0
|
281 */
|
Chris@0
|
282 public function hasTranslation(LanguageInterface $language);
|
Chris@0
|
283
|
Chris@0
|
284 /**
|
Chris@17
|
285 * Populate the config mapper with route match data.
|
Chris@0
|
286 *
|
Chris@0
|
287 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
|
Chris@0
|
288 * The route match.
|
Chris@17
|
289 *
|
Chris@17
|
290 * @see \Drupal\config_translation\Event\ConfigTranslationEvents::POPULATE_MAPPER
|
Chris@0
|
291 */
|
Chris@0
|
292 public function populateFromRouteMatch(RouteMatchInterface $route_match);
|
Chris@0
|
293
|
Chris@0
|
294 /**
|
Chris@0
|
295 * Returns the name of the contextual link group to add contextual links to.
|
Chris@0
|
296 *
|
Chris@0
|
297 * @return string|null
|
Chris@0
|
298 * A contextual link group name or null if no link should be added.
|
Chris@0
|
299 */
|
Chris@0
|
300 public function getContextualLinkGroup();
|
Chris@0
|
301
|
Chris@0
|
302 }
|