class EntityTypeParamConverter in Synonyms 8
Same name and namespace in other branches
- 2.0.x src/ParamConverter/EntityTypeParamConverter.php \Drupal\synonyms\ParamConverter\EntityTypeParamConverter
Param converter service for entity types.
Hierarchy
- class \Drupal\synonyms\ParamConverter\EntityTypeParamConverter implements ParamConverterInterface
Expanded class hierarchy of EntityTypeParamConverter
1 string reference to 'EntityTypeParamConverter'
1 service uses EntityTypeParamConverter
File
- src/
ParamConverter/ EntityTypeParamConverter.php, line 12
Namespace
Drupal\synonyms\ParamConverterView source
class EntityTypeParamConverter implements ParamConverterInterface {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* EntityTypeParamConverter constructor.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
return $this->entityTypeManager
->getDefinition($value);
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
return !empty($definition['type']) && $definition['type'] == 'synonyms_entity_type';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityTypeParamConverter:: |
protected | property | The entity type manager. | |
EntityTypeParamConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
EntityTypeParamConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
EntityTypeParamConverter:: |
public | function | EntityTypeParamConverter constructor. |