getQueryParams()['data']['position'] ?? []; $pageUid = (int)($position['pageUid'] ?? 0); $insertPosition = $position['insertPosition'] ?? 'inside'; $parentPageUid = $insertPosition === 'inside' ? $pageUid : (BackendUtility::getRecord('pages', $pageUid, 'pid')['pid'] ?? null); $backendUser = $this->getBackendUser(); $parentPage = BackendUtility::readPageAccess((int)$parentPageUid, $backendUser->getPagePermsClause(Permission::PAGE_NEW)); if (!$parentPage) { return new JsonResponse(null, 403); } $formDataGroup = GeneralUtility::makeInstance(OnTheFly::class); $formDataGroup->setProviderList([ InitializeProcessedTca::class, DatabaseParentPageRow::class, DatabaseUserPermissionCheck::class, DatabaseEffectivePid::class, UserTsConfig::class, PageTsConfig::class, DatabaseRowInitializeNew::class, DatabaseUniqueUidNewRow::class, TcaSelectItems::class, ]); $doktypes = $this->formDataCompiler ->compile( [ 'command' => 'new', 'request' => $request, 'tableName' => 'pages', 'vanillaUid' => $parentPageUid, ], $formDataGroup )['processedTca']['columns']['doktype']['config']['items'] ?? []; $result = []; foreach ($doktypes as $doktype) { $result[] = [ 'value' => $doktype['value'] ?? '', 'label' => $doktype['label'] ?? '', 'icon' => $doktype['icon'] ?? '', 'description' => $doktype['description'] ?? '', ]; } return new JsonResponse($result, 200); } public function getPageDetailAction(ServerRequestInterface $request): ResponseInterface { $params = $request->getQueryParams(); $pageUid = $params['pageUid'] ?? null; if ($pageUid === null) { return new JsonResponse(['error' => 'Missing required query parameter: pageUid'], 400); } if ((int)$pageUid === 0) { return new JsonResponse([ 'uid' => 0, 'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ?? 'TYPO3', 'icon' => 'apps-pagetree-root', ]); } $page = BackendUtility::readPageAccess((int)$pageUid, $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW)); if (!$page) { return new JsonResponse(null, 403); } $recordInfo = [ 'uid' => $page['uid'], 'title' => $page['title'], 'icon' => $this->iconFactory->getIconForRecord('pages', $page, IconSize::SMALL)->getIdentifier(), ]; return new JsonResponse($recordInfo); } public function getProcessedValueAction(ServerRequestInterface $request): ResponseInterface { $params = $request->getQueryParams(); $fields = $params['fields'] ?? []; $pageUid = (int)($params['pageUid'] ?? 0); $page = BackendUtility::readPageAccess($pageUid, $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW)); if (!$page) { return new JsonResponse(null, 403); } $result = []; foreach ($fields as $fieldName => $value) { $result[$fieldName] = BackendUtility::getProcessedValue('pages', $fieldName, $value, 0, false, false, 0, true, $pageUid); } return new JsonResponse($result); } private function getBackendUser(): BackendUserAuthentication { return $GLOBALS['BE_USER']; } }