class OpenApiUiParamConverter in OpenAPI UI 8
Defines a ParamConverter for openapi_ui Plugins.
Hierarchy
- class \Drupal\openapi_ui\ParamConverter\OpenApiUiParamConverter implements ParamConverterInterface
Expanded class hierarchy of OpenApiUiParamConverter
1 string reference to 'OpenApiUiParamConverter'
1 service uses OpenApiUiParamConverter
File
- src/
ParamConverter/ OpenApiUiParamConverter.php, line 14
Namespace
Drupal\openapi_ui\ParamConverterView source
class OpenApiUiParamConverter implements ParamConverterInterface {
/**
* Current openapi generator plugin manager.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
public $openApiUiManager;
/**
* Creates a new OpenApiUiParamConverter.
*
* @param \Drupal\Component\Plugin\PluginManagerInterface $openapi_ui_manager
* The current openapi ui plugin manager instance.
*/
public function __construct(PluginManagerInterface $openapi_ui_manager) {
$this->openApiUiManager = $openapi_ui_manager;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
try {
$plugin = $this->openApiUiManager
->createInstance($value);
} catch (PluginNotFoundException $e) {
// Plugin Not found, we can't convert it the param.
return NULL;
}
return $plugin;
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
return !empty($definition['type']) && $definition['type'] == 'openapi_ui';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
OpenApiUiParamConverter:: |
public | property | Current openapi generator plugin manager. | |
OpenApiUiParamConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
OpenApiUiParamConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
OpenApiUiParamConverter:: |
public | function | Creates a new OpenApiUiParamConverter. |