interface ParamConverterInterface
Same name in other branches
- 9 core/lib/Drupal/Core/ParamConverter/ParamConverterInterface.php \Drupal\Core\ParamConverter\ParamConverterInterface
- 10 core/lib/Drupal/Core/ParamConverter/ParamConverterInterface.php \Drupal\Core\ParamConverter\ParamConverterInterface
- 11.x core/lib/Drupal/Core/ParamConverter/ParamConverterInterface.php \Drupal\Core\ParamConverter\ParamConverterInterface
Interface for parameter converters.
Classes implementing this interface are responsible for converting a path parameter to the object it represents.
Here is an example path: /admin/structure/block/manage/{block}
In this case, '{block}' would be the path parameter which should be turned into a block object representing the block in question.
ParamConverters are defined as services tagged with 'paramconverter', and are managed by the 'paramconverter_manager' service.
Hierarchy
- interface \Drupal\Core\ParamConverter\ParamConverterInterface
Expanded class hierarchy of ParamConverterInterface
All classes that implement ParamConverterInterface
See also
\Drupal\Core\ParamConverter\ParamConverterManagerInterface
\Drupal\Core\ParamConverter\EntityConverter
5 files declare their use of ParamConverterInterface
- LanguageConverter.php in core/
modules/ language/ src/ LanguageConverter.php - LayoutTempstoreParamConverter.php in core/
modules/ layout_builder/ src/ Routing/ LayoutTempstoreParamConverter.php - NodePreviewConverter.php in core/
modules/ node/ src/ ParamConverter/ NodePreviewConverter.php - ResourceTypeConverter.php in core/
modules/ jsonapi/ src/ ParamConverter/ ResourceTypeConverter.php - ViewUIConverter.php in core/
modules/ views_ui/ src/ ParamConverter/ ViewUIConverter.php
File
-
core/
lib/ Drupal/ Core/ ParamConverter/ ParamConverterInterface.php, line 25
Namespace
Drupal\Core\ParamConverterView source
interface ParamConverterInterface {
/**
* Converts path variables to their corresponding objects.
*
* @param mixed $value
* The raw value.
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param array $defaults
* The route defaults array.
*
* @return mixed|null
* The converted parameter value.
*/
public function convert($value, $definition, $name, array $defaults);
/**
* Determines if the converter applies to a specific route and variable.
*
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param \Symfony\Component\Routing\Route $route
* The route to consider attaching to.
*
* @return bool
* TRUE if the converter applies to the passed route and parameter, FALSE
* otherwise.
*/
public function applies($definition, $name, Route $route);
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
ParamConverterInterface::applies | public | function | Determines if the converter applies to a specific route and variable. | 12 |
ParamConverterInterface::convert | public | function | Converts path variables to their corresponding objects. | 12 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.