diff --git a/src/bundle/Controller/UserController.php b/src/bundle/Controller/UserController.php index d3f806d..278a8b5 100644 --- a/src/bundle/Controller/UserController.php +++ b/src/bundle/Controller/UserController.php @@ -170,7 +170,7 @@ public function editAction( string $language, Request $request ) { - $user = $this->userService->loadUser($contentId); + $user = $this->userService->loadUser($contentId, [$language]); if (!$this->permissionResolver->canUser('content', 'edit', $user)) { throw new CoreUnauthorizedException('content', 'edit', ['userId' => $contentId]); } diff --git a/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php b/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php index 628e1da..1ad1b49 100644 --- a/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php +++ b/src/lib/FieldType/Mapper/UserAccountFieldValueFormMapper.php @@ -10,8 +10,8 @@ use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition; use eZ\Publish\Core\FieldType\User\Value as ApiUserValue; +use EzSystems\EzPlatformContentForms\Data\Content\ContentUpdateData; use EzSystems\EzPlatformContentForms\Data\Content\FieldData; -use EzSystems\EzPlatformContentForms\Data\ContentTranslationData; use EzSystems\EzPlatformContentForms\Data\User\UserAccountFieldData; use EzSystems\EzPlatformContentForms\FieldType\FieldValueFormMapperInterface; use EzSystems\EzPlatformContentForms\Form\Type\FieldType\UserAccountFieldType; @@ -46,22 +46,22 @@ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data) $formConfig = $fieldForm->getConfig(); $rootForm = $fieldForm->getRoot()->getRoot(); $formIntent = $rootForm->getConfig()->getOption('intent'); - $isTranslation = $rootForm->getData() instanceof ContentTranslationData; + $formData = $rootForm->getData(); + if ($formData instanceof ContentUpdateData) { + return; + } + $formBuilder = $formConfig->getFormFactory()->createBuilder() ->create('value', UserAccountFieldType::class, [ 'required' => true, 'label' => $fieldDefinition->getName(), 'intent' => $formIntent, 'constraints' => [ - new UserAccountPassword(['contentType' => $rootForm->getData()->contentType]), + new UserAccountPassword(['contentType' => $formData->contentType]), ], ]); - if ($isTranslation) { - $formBuilder->addModelTransformer($this->getModelTransformerForTranslation($fieldDefinition)); - } else { - $formBuilder->addModelTransformer($this->getModelTransformer()); - } + $formBuilder->addModelTransformer($this->getModelTransformer()); $formBuilder->setAutoInitialize(false);