You are here

public function EntityCloneForm::__construct in Entity Clone 8

Constructs a new Entity Clone form.

Parameters

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

\Drupal\Core\Routing\RouteMatchInterface $route_match: The route match service.

\Drupal\Core\StringTranslation\TranslationManager $string_translation: The string translation manager.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher: The event dispatcher service.

\Drupal\Core\Messenger\Messenger $messenger: The messenger service.

\Drupal\Core\Session\AccountProxyInterface $currentUser: The current user.

\Drupal\entity_clone\EntityCloneSettingsManager $entity_clone_settings_manager: The entity clone settings manager.

\Drupal\entity_clone\Services\EntityCloneServiceProvider $service_provider: The Service Provider that verifies if entity has ownership.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/Form/EntityCloneForm.php, line 110

Class

EntityCloneForm
Implements an entity Clone form.

Namespace

Drupal\entity_clone\Form

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, RouteMatchInterface $route_match, TranslationManager $string_translation, EventDispatcherInterface $eventDispatcher, Messenger $messenger, AccountProxyInterface $currentUser, EntityCloneSettingsManager $entity_clone_settings_manager, EntityCloneServiceProvider $service_provider) {
  $this->entityTypeManager = $entity_type_manager;
  $this->stringTranslationManager = $string_translation;
  $this->eventDispatcher = $eventDispatcher;
  $this->messenger = $messenger;
  $parameter_name = $route_match
    ->getRouteObject()
    ->getOption('_entity_clone_entity_type_id');
  $this->entity = $route_match
    ->getParameter($parameter_name);
  $this->entityTypeDefinition = $entity_type_manager
    ->getDefinition($this->entity
    ->getEntityTypeId());
  $this->currentUser = $currentUser;
  $this->entityCloneSettingsManager = $entity_clone_settings_manager;
  $this->serviceProvider = $service_provider;
}