3 namespace Drupal\Core\ParamConverter;
5 use Symfony\Component\Routing\Route;
8 * Interface for parameter converters.
10 * Classes implementing this interface are responsible for converting a path
11 * parameter to the object it represents.
13 * Here is an example path: /admin/structure/block/manage/{block}
15 * In this case, '{block}' would be the path parameter which should be turned
16 * into a block object representing the block in question.
18 * ParamConverters are defined as services tagged with 'paramconverter', and are
19 * managed by the 'paramconverter_manager' service.
22 * @see \Drupal\Core\ParamConverter\ParamConverterManagerInterface
23 * @see \Drupal\Core\ParamConverter\EntityConverter
25 interface ParamConverterInterface {
28 * Converts path variables to their corresponding objects.
32 * @param mixed $definition
33 * The parameter definition provided in the route options.
35 * The name of the parameter.
36 * @param array $defaults
37 * The route defaults array.
40 * The converted parameter value.
42 public function convert($value, $definition, $name, array $defaults);
45 * Determines if the converter applies to a specific route and variable.
47 * @param mixed $definition
48 * The parameter definition provided in the route options.
50 * The name of the parameter.
51 * @param \Symfony\Component\Routing\Route $route
52 * The route to consider attaching to.
55 * TRUE if the converter applies to the passed route and parameter, FALSE
58 public function applies($definition, $name, Route $route);