7c7 < if (!empty($entity_info['fieldable'])) { --- > if ($entity_info->isFieldable()) { 95,96c95,96 < @@ -330,7 +381,11 @@ function content_translation_view_access(EntityInterface $entity, $langcode, Acc < if (!empty($info['permission_granularity']) && $info['permission_granularity'] == 'bundle') { --- > @@ -353,7 +404,11 @@ function content_translation_view_access(EntityInterface $entity, $langcode, Acc > if ($info->getPermissionGranularity() == 'bundle') { 108,110c108,122 < @@ -514,7 +569,7 @@ function content_translation_enabled($entity_type, $bundle = NULL) { < function content_translation_controller($entity_type) { < $entity_info = entity_get_info($entity_type); --- > @@ -528,17 +583,19 @@ function content_translation_enabled($entity_type, $bundle = NULL) { > * > * @param string $entity_type > * The type of the entity being translated. > + * @param \Drupal\Core\Session\AccountInterface $account > + * The user who is translating the entity. > * > * @return \Drupal\content_translation\ContentTranslationControllerInterface > * An instance of the content translation controller interface. > * > * @todo Move to \Drupal\content_translation\ContentTranslationManager. > */ > -function content_translation_controller($entity_type) { > +function content_translation_controller($entity_type, AccountInterface $account = NULL) { > $entity_info = \Drupal::entityManager()->getDefinition($entity_type); 112,113c124,126 < - return new $entity_info['controllers']['translation']($entity_type, $entity_info); < + return new $entity_info['controllers']['translation']($entity_type, $entity_info, \Drupal::currentUser()); --- > $class = $entity_info->getControllerClass('translation'); > - return new $class($entity_info); > + return new $class($entity_info, $account); 141c154 < @@ -707,14 +765,26 @@ function content_translation_entity_insert(EntityInterface $entity) { --- > @@ -731,14 +791,26 @@ function content_translation_entity_insert(EntityInterface $entity) { 168c181 < 'uid' => $GLOBALS['user']->id(), --- > 'uid' => \Drupal::currentUser()->id(), 245c258,259 < @@ -52,7 +52,7 @@ public function access(Route $route, Request $request, AccountInterface $account --- > @@ -44,7 +44,7 @@ public function access(Route $route, Request $request, AccountInterface $account > if ($entity = $request->attributes->get($entity_type)) { 248,250c262,263 < $controller_class = $this->entityManager->getControllerClass($entity_type, 'translation'); < - $controller = new $controller_class($entity_type, $entity->entityInfo()); < + $controller = new $controller_class($entity_type, $entity->entityInfo(), $account); --- > - $controller = content_translation_controller($entity_type); > + $controller = content_translation_controller($entity_type, $account); 255c268 < index 6d14c1b..7805250 100644 --- > index e99c9b0..87739e6 100644 266c279 < @@ -30,16 +31,26 @@ class ContentTranslationController implements ContentTranslationControllerInterf --- > @@ -30,14 +31,24 @@ class ContentTranslationController implements ContentTranslationControllerInterf 279,281c292 < * @param string $entity_type < * The type of the entity being translated. < * @param array $entity_info --- > * @param \Drupal\Core\Entity\EntityTypeInterface $entity_info 283c294 < + * @param \Drupal\Core\Session\AccountInterface --- > + * @param \Drupal\Core\Session\AccountInterface $account 286,288c297,299 < - public function __construct($entity_type, $entity_info) { < + public function __construct($entity_type, $entity_info, $current_user) { < $this->entityType = $entity_type; --- > - public function __construct($entity_info) { > + public function __construct($entity_info, AccountInterface $account = NULL) { > $this->entityType = $entity_info->id(); 290c301 < + $this->currentUser = $current_user; --- > + $this->currentUser = (empty($account)) ? \Drupal::currentUser() : $account;