public function AutoEntityLabelForm::__construct in Automatic Entity Label 8.3
Same name and namespace in other branches
- 8 src/Form/AutoEntityLabelForm.php \Drupal\auto_entitylabel\Form\AutoEntityLabelForm::__construct()
- 8.2 src/Form/AutoEntityLabelForm.php \Drupal\auto_entitylabel\Form\AutoEntityLabelForm::__construct()
AutoEntityLabelController constructor.
Parameters
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: Config Factory.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager service.
\Drupal\Core\Routing\RouteMatchInterface $route_match: Route Match.
\Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler: Module Handler.
\Drupal\Core\Session\AccountInterface $user: Account Interface.
Overrides ConfigFormBase::__construct
File
- src/
Form/ AutoEntityLabelForm.php, line 95
Class
- AutoEntityLabelForm
- Class AutoEntityLabelForm.
Namespace
Drupal\auto_entitylabel\FormCode
public function __construct(ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, RouteMatchInterface $route_match, ModuleHandlerInterface $moduleHandler, AccountInterface $user) {
parent::__construct($config_factory);
$this->entityTypeManager = $entity_type_manager;
$this->routeMatch = $route_match;
$route_options = $this->routeMatch
->getRouteObject()
->getOptions();
$array_keys = array_keys($route_options['parameters']);
$this->entityType = array_shift($array_keys);
$entity_type = $this->routeMatch
->getParameter($this->entityType);
$this->entityBundle = $entity_type
->id();
$this->entityTypeBundleOf = $entity_type
->getEntityType()
->getBundleOf();
$this->moduleHandler = $moduleHandler;
$this->user = $user;
}