Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\Core\ParamConverter;
|
Chris@0
|
4
|
Chris@0
|
5 use Symfony\Component\Routing\RouteCollection;
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * Provides an interface for a parameter converter manager.
|
Chris@0
|
9 */
|
Chris@0
|
10 interface ParamConverterManagerInterface {
|
Chris@0
|
11
|
Chris@0
|
12 /**
|
Chris@0
|
13 * Registers a parameter converter with the manager.
|
Chris@0
|
14 *
|
Chris@0
|
15 * @param \Drupal\Core\ParamConverter\ParamConverterInterface $param_converter
|
Chris@0
|
16 * The added param converter instance.
|
Chris@0
|
17 * @param string $id
|
Chris@0
|
18 * The parameter converter service id to register.
|
Chris@0
|
19 *
|
Chris@0
|
20 * @return $this
|
Chris@0
|
21 */
|
Chris@0
|
22 public function addConverter(ParamConverterInterface $param_converter, $id);
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * Lazy-loads converter services.
|
Chris@0
|
26 *
|
Chris@0
|
27 * @param string $id
|
Chris@0
|
28 * The service id of converter service to load.
|
Chris@0
|
29 *
|
Chris@0
|
30 * @return \Drupal\Core\ParamConverter\ParamConverterInterface
|
Chris@0
|
31 * The loaded converter service identified by the given service id.
|
Chris@0
|
32 *
|
Chris@0
|
33 * @throws \InvalidArgumentException
|
Chris@0
|
34 * If the given service id is not a registered converter.
|
Chris@0
|
35 */
|
Chris@0
|
36 public function getConverter($id);
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Saves a list of applicable converters to each route.
|
Chris@0
|
40 *
|
Chris@0
|
41 * @param \Symfony\Component\Routing\RouteCollection $routes
|
Chris@0
|
42 * A collection of routes to apply converters to.
|
Chris@0
|
43 */
|
Chris@0
|
44 public function setRouteParameterConverters(RouteCollection $routes);
|
Chris@0
|
45
|
Chris@0
|
46 /**
|
Chris@0
|
47 * Invokes the registered converter for each defined parameter on a route.
|
Chris@0
|
48 *
|
Chris@0
|
49 * @param array $defaults
|
Chris@0
|
50 * The route defaults array.
|
Chris@0
|
51 *
|
Chris@0
|
52 * @return array
|
Chris@0
|
53 * The modified defaults.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @throws \Drupal\Core\ParamConverter\ParamNotConvertedException
|
Chris@0
|
56 * If one of the assigned converters returned NULL because the given
|
Chris@0
|
57 * variable could not be converted.
|
Chris@0
|
58 */
|
Chris@0
|
59 public function convert(array $defaults);
|
Chris@0
|
60
|
Chris@0
|
61 }
|