1717use Ibexa \ContentForms \User \View \UserCreateView ;
1818use Ibexa \ContentForms \User \View \UserUpdateView ;
1919use Ibexa \Contracts \ContentForms \Content \Form \Provider \GroupedContentFormFieldsProviderInterface ;
20+ use Ibexa \Contracts \Core \Repository \ContentService ;
2021use Ibexa \Contracts \Core \Repository \ContentTypeService ;
2122use Ibexa \Contracts \Core \Repository \Exceptions \UnauthorizedException ;
2223use Ibexa \Contracts \Core \Repository \LanguageService ;
@@ -53,6 +54,8 @@ class UserController extends Controller
5354 /** @var \Ibexa\Contracts\ContentForms\Content\Form\Provider\GroupedContentFormFieldsProviderInterface */
5455 private $ groupedContentFormFieldsProvider ;
5556
57+ private ContentService $ contentService ;
58+
5659 public function __construct (
5760 ContentTypeService $ contentTypeService ,
5861 UserService $ userService ,
@@ -61,7 +64,8 @@ public function __construct(
6164 ActionDispatcherInterface $ userActionDispatcher ,
6265 PermissionResolver $ permissionResolver ,
6366 UserLanguagePreferenceProviderInterface $ userLanguagePreferenceProvider ,
64- GroupedContentFormFieldsProviderInterface $ groupedContentFormFieldsProvider
67+ GroupedContentFormFieldsProviderInterface $ groupedContentFormFieldsProvider ,
68+ ContentService $ contentService
6569 ) {
6670 $ this ->contentTypeService = $ contentTypeService ;
6771 $ this ->userService = $ userService ;
@@ -71,6 +75,7 @@ public function __construct(
7175 $ this ->permissionResolver = $ permissionResolver ;
7276 $ this ->userLanguagePreferenceProvider = $ userLanguagePreferenceProvider ;
7377 $ this ->groupedContentFormFieldsProvider = $ groupedContentFormFieldsProvider ;
78+ $ this ->contentService = $ contentService ;
7479 }
7580
7681 /**
@@ -114,6 +119,7 @@ public function createAction(
114119 $ form = $ this ->createForm (UserCreateType::class, $ data , [
115120 'languageCode ' => $ language ->languageCode ,
116121 'mainLanguageCode ' => $ language ->languageCode ,
122+ 'struct ' => $ data ,
117123 ]);
118124 $ form ->handleRequest ($ request );
119125
@@ -152,6 +158,7 @@ public function createAction(
152158 * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
153159 * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
154160 * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException
161+ * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException
155162 * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentType
156163 * @throws \Ibexa\Core\Base\Exceptions\UnauthorizedException
157164 */
@@ -192,9 +199,11 @@ public function editAction(
192199 $ userUpdate ,
193200 [
194201 'location ' => $ location ,
202+ 'content ' => $ this ->contentService ->loadContent ($ contentId ),
195203 'languageCode ' => $ language ,
196204 'mainLanguageCode ' => $ user ->contentInfo ->mainLanguageCode ,
197- ]
205+ 'struct ' => $ userUpdate ,
206+ ],
198207 );
199208 $ form ->handleRequest ($ request );
200209
0 commit comments