You are here

public function AutoEntityLabelManager::__construct in Automatic Entity Label 8.3

Same name and namespace in other branches
  1. 8 src/AutoEntityLabelManager.php \Drupal\auto_entitylabel\AutoEntityLabelManager::__construct()
  2. 8.2 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.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: Module handler.

File

src/AutoEntityLabelManager.php, line 124

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, ModuleHandlerInterface $module_handler) {
  $this->entity = $entity;
  $this->entityType = $entity
    ->getEntityType()
    ->id();
  $this->entityBundle = $entity
    ->bundle();
  $this->bundleEntityType = $entity_type_manager
    ->getDefinition($this->entityType)
    ->getBundleEntityType();
  $this->configFactory = $config_factory;
  $this->entityTypeManager = $entity_type_manager;
  $this->token = $token;
  $this->moduleHandler = $module_handler;
}