class EntityDecorator in Commerce AutoSKU 8.2
Provides an content entity decorator for automatic label generation.
Hierarchy
- class \Drupal\commerce_autosku\EntityDecorator implements EntityDecoratorInterface
Expanded class hierarchy of EntityDecorator
1 string reference to 'EntityDecorator'
1 service uses EntityDecorator
File
- src/
EntityDecorator.php, line 16 - Contains \Drupal\commerce_autosku\EntityDecorator.
Namespace
Drupal\commerce_autoskuView source
class EntityDecorator implements EntityDecoratorInterface {
/**
* The content entity that is decorated.
*
* @var ContentEntityInterface
*/
protected $entity;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManager
*/
protected $entityTypeManager;
/**
* The generator manager.
*
* @var \Drupal\commerce_autosku\CommerceAutoSkuGeneratorManagerInterface
*/
protected $generatorManager;
/**
* Constructs an EntityDecorator object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager
* @param \Drupal\commerce_autosku\CommerceAutoSkuGeneratorManagerInterface $generator_manager
* The generator manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, CommerceAutoSkuGeneratorManagerInterface $generator_manager) {
$this->entityTypeManager = $entity_type_manager;
$this->generatorManager = $generator_manager;
}
/**
* {@inheritdoc}
*/
public function decorate(ContentEntityInterface $entity) {
$this->entity = new CommerceAutoSkuManager($entity, $this->entityTypeManager, $this->generatorManager);
return $this->entity;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityDecorator:: |
protected | property | The content entity that is decorated. | |
EntityDecorator:: |
protected | property | The entity type manager. | |
EntityDecorator:: |
protected | property | The generator manager. | |
EntityDecorator:: |
public | function |
Automatic entity label entity decorator. Overrides EntityDecoratorInterface:: |
|
EntityDecorator:: |
public | function | Constructs an EntityDecorator object. |