public function editAction(
        int $contentId,
        ?int $versionNo = null,
        ?string $language = null,
        Request $request
    ) {
        $user = $this->userService->loadUser($contentId);
        if (!$this->permissionResolver->canUser('content', 'edit', $user)) {
            throw new CoreUnauthorizedException('content', 'edit', ['userId' => $contentId]);
        }
        $contentType = $this->contentTypeService->loadContentType($user->contentInfo->contentTypeId);

        $userUpdate = (new UserUpdateMapper())->mapToFormData($user, $contentType, [
            'languageCode' => $language,
        ]);
        $form = $this->createForm(
            UserUpdateType::class,
            $userUpdate,
            [
                'languageCode' => $language,
                'mainLanguageCode' => $user->contentInfo->mainLanguageCode,
            ]
        );
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid() && null !== $form->getClickedButton()) {
            $this->userActionDispatcher->dispatchFormAction($form, $userUpdate, $form->getClickedButton()->getName());
            if ($response = $this->userActionDispatcher->getResponse()) {
                return $response;
            }
        }

        return new UserUpdateView(null, [
            'form' => $form->createView(),
            'languageCode' => $language,
            'contentType' => $contentType,
            'user' => $user,
        ]);
    }
public function editAction(
        int $contentId,
        ?int $versionNo = null,
        ?string $language = null,
        Request $request
    ) {
        $user = $this->userService->loadUser($contentId);
        if (!$this->permissionResolver->canUser('content', 'edit', $user)) {
            throw new CoreUnauthorizedException('content', 'edit', ['userId' => $contentId]);
        }
        $contentType = $this->contentTypeService->loadContentType($user->contentInfo->contentTypeId);

        $userUpdate = (new UserUpdateMapper())->mapToFormData($user, $contentType, [
            'languageCode' => $language,
        ]);
        $form = $this->createForm(
            UserUpdateType::class,
            $userUpdate,
            [
                'languageCode' => $language,
                'mainLanguageCode' => $user->contentInfo->mainLanguageCode,
            ]
        );
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid() && null !== $form->getClickedButton()) {
            $this->userActionDispatcher->dispatchFormAction($form, $userUpdate, $form->getClickedButton()->getName());
            if ($response = $this->userActionDispatcher->getResponse()) {
                return $response;
            }
        }

        return new UserUpdateView(null, [
            'form' => $form->createView(),
            'languageCode' => $language,
            'contentType' => $contentType,
            'user' => $user,
        ]);
    }
public function editAction ( int $ contentId , ? int $ versionNo = null , ? string $ language = null , Request $ request ) { $ user = $ this -> userService -> loadUser ( $ contentId ) ; if ( ! $ this -> permissionResolver -> canUser ( 'content' , 'edit' , $ user ) ) { throw new CoreUnauthorizedException ( 'content' , 'edit' , [ 'userId' => $ contentId ] ) ; } $ contentType = $ this -> contentTypeService -> loadContentType ( $ user -> contentInfo -> contentTypeId ) ; $ userUpdate = ( new UserUpdateMapper ( ) ) -> mapToFormData ( $ user , $ contentType , [ 'languageCode' => $ language , ] ) ; $ form = $ this -> createForm ( UserUpdateType :: class , $ userUpdate , [ 'languageCode' => $ language , 'mainLanguageCode' => $ user -> contentInfo -> mainLanguageCode , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) && null !== $ form -> getClickedButton ( ) ) { $ this -> userActionDispatcher -> dispatchFormAction ( $ form , $ userUpdate , $ form -> getClickedButton ( ) -> getName ( ) ) ; if ( $ response = $ this -> userActionDispatcher -> getResponse ( ) ) { return $ response ; } } return new UserUpdateView ( null , [ 'form' => $ form -> createView ( ) , 'languageCode' => $ language , 'contentType' => $ contentType , 'user' => $ user , ] ) ; }
Displays a user update form that updates user data and related content item.

@param int|null $contentId ContentType id to create
@param int|null $versionNo Version number the version should be created from. Defaults to the currently published one.
@param string|null $language Language code to create the version in (eng-GB, ger-DE, ...))
@param Request $request

@return UserUpdateView|Response

@throws \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
@throws \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
@throws \Symfony\Component\OptionsResolver\Exception\NoSuchOptionException
@throws \Symfony\Component\OptionsResolver\Exception\MissingOptionsException
@throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
@throws \Symfony\Component\OptionsResolver\Exception\AccessException
@throws InvalidArgumentType
@throws UnauthorizedException
@throws NotFoundException
@throws BadStateException If the version isn't editable, or if there is no editable version.
Displays a user update form that updates user data and related content item .