class CourierChannelConverter in Courier 8
Same name in this branch
- 8 src/ParamConverter/CourierChannelConverter.php \Drupal\courier\ParamConverter\CourierChannelConverter
- 8 src/ProxyClass/ParamConverter/CourierChannelConverter.php \Drupal\courier\ProxyClass\ParamConverter\CourierChannelConverter
Same name and namespace in other branches
- 2.x src/ParamConverter/CourierChannelConverter.php \Drupal\courier\ParamConverter\CourierChannelConverter
Provides upcasting for a courier channel entity type ID.
Hierarchy
- class \Drupal\courier\ParamConverter\CourierChannelConverter implements ParamConverterInterface
Expanded class hierarchy of CourierChannelConverter
1 string reference to 'CourierChannelConverter'
1 service uses CourierChannelConverter
File
- src/
ParamConverter/ CourierChannelConverter.php, line 12
Namespace
Drupal\courier\ParamConverterView source
class CourierChannelConverter implements ParamConverterInterface {
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new EntityConverter.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public function convert($value, $definition, $name, array $defaults) {
if ($definition = $this->entityTypeManager
->getDefinition($value, FALSE)) {
if ($definition
->isSubclassOf('\\Drupal\\courier\\ChannelInterface')) {
return $definition;
}
}
return NULL;
}
/**
* {@inheritdoc}
*/
public function applies($definition, $name, Route $route) {
return !empty($definition['type']) && $definition['type'] == 'courier_channel';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CourierChannelConverter:: |
protected | property | The entity manager. | |
CourierChannelConverter:: |
public | function |
Determines if the converter applies to a specific route and variable. Overrides ParamConverterInterface:: |
|
CourierChannelConverter:: |
public | function |
Converts path variables to their corresponding objects. Overrides ParamConverterInterface:: |
|
CourierChannelConverter:: |
public | function | Constructs a new EntityConverter. |