Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/ParamConverter/ParamConverterInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Core\ParamConverter; | |
4 | |
5 use Symfony\Component\Routing\Route; | |
6 | |
7 /** | |
8 * Interface for parameter converters. | |
9 * | |
10 * Classes implementing this interface are responsible for converting a path | |
11 * parameter to the object it represents. | |
12 * | |
13 * Here is an example path: /admin/structure/block/manage/{block} | |
14 * | |
15 * In this case, '{block}' would be the path parameter which should be turned | |
16 * into a block object representing the block in question. | |
17 * | |
18 * ParamConverters are defined as services tagged with 'paramconverter', and are | |
19 * managed by the 'paramconverter_manager' service. | |
20 * | |
21 * @see menu | |
22 * @see \Drupal\Core\ParamConverter\ParamConverterManagerInterface | |
23 * @see \Drupal\Core\ParamConverter\EntityConverter | |
24 */ | |
25 interface ParamConverterInterface { | |
26 | |
27 /** | |
28 * Converts path variables to their corresponding objects. | |
29 * | |
30 * @param mixed $value | |
31 * The raw value. | |
32 * @param mixed $definition | |
33 * The parameter definition provided in the route options. | |
34 * @param string $name | |
35 * The name of the parameter. | |
36 * @param array $defaults | |
37 * The route defaults array. | |
38 * | |
39 * @return mixed|null | |
40 * The converted parameter value. | |
41 */ | |
42 public function convert($value, $definition, $name, array $defaults); | |
43 | |
44 /** | |
45 * Determines if the converter applies to a specific route and variable. | |
46 * | |
47 * @param mixed $definition | |
48 * The parameter definition provided in the route options. | |
49 * @param string $name | |
50 * The name of the parameter. | |
51 * @param \Symfony\Component\Routing\Route $route | |
52 * The route to consider attaching to. | |
53 * | |
54 * @return bool | |
55 * TRUE if the converter applies to the passed route and parameter, FALSE | |
56 * otherwise. | |
57 */ | |
58 public function applies($definition, $name, Route $route); | |
59 | |
60 } |