You are here

public function AutoEntityLabelManager::__construct in Automatic Entity Label 8.2

Same name and namespace in other branches
  1. 8.3 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::__construct()
  2. 8 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::__construct()

Constructs an AutoEntityLabelManager object.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity to add the automatic label to.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: Configuration factory.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Entity type manager.

\Drupal\Core\Utility\Token $token: Token manager.

File

src/AutoEntityLabelManager.php, line 109

Class

AutoEntityLabelManager
Class for Auto Entity Label Manager.

Namespace

Drupal\auto_entitylabel

Code

public function __construct(ContentEntityInterface $entity, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, Token $token) {
  $this->entity = $entity;
  $this->entity_type = $entity
    ->getEntityType()
    ->id();
  $this->entity_bundle = $entity
    ->bundle();
  $this->bundle_entity_type = $entity_type_manager
    ->getDefinition($this->entity_type)
    ->getBundleEntityType();
  $this->configFactory = $config_factory;
  $this->entityTypeManager = $entity_type_manager;
  $this->token = $token;
}