comparison core/modules/config_translation/src/ConfigMapperInterface.php @ 0:4c8ae668cc8c

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