Typo3 V10 > V11 » History » Revision 12
Revision 11 (Enis Nuredini, 13.04.2023 09:59) → Revision 12/22 (Enis Nuredini, 13.04.2023 10:28)
h1. Migration Typo3 v10 > v11 Some changes in php are needed to get QFQ work in v11. h3. 1. Extensions Upgrades |_.Extension|_.Version| | LDAP| V3.7.1| h3. 2. File ext_localconf.php The configurePlugin block needs to be changed to following: <pre> \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 'IMATHUZH.qfq', 'Qfq', [\IMATHUZH\Qfq\Controller\QfqController::class => 'show'], [\IMATHUZH\Qfq\Controller\QfqController::class => 'show'], // put here as well, if controller output must not be cached \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT ); </pre> h3. 3. QFQ Class QfqController.php Two new needed Classes needs to be linked: <pre> use Psr\Http\Message\ResponseInterface; use TYPO3\CMS\Core\Http\HtmlResponse; </pre> Changes for the showAction() function: <pre> public function showAction(): ResponseInterface { $html = ''; $origErrorReporting = ''; $flagOk = false; try { $contentObject = $this->configurationManager->getContentObject(); // By T3 default 'E_NOTICE' is unset. E.g. 'Undefined Index' will throw an exception. // QFQ like to see those 'E_NOTICE' $origErrorReporting = error_reporting(); error_reporting($origErrorReporting | E_NOTICE); $qfq = new QuickFormQuery($contentObject->data); $html = $qfq->process(); $flagOk = true; } catch (\UserFormException $e) { $html = $e->formatMessage(); } catch (\UserReportException $e) { $html = $e->formatMessage(); } catch (\CodeException $e) { $html = $e->formatMessage(); } catch (\DbException $e) { $html = $e->formatMessage(); } catch (\ShellException $e) { $html = $e->formatMessage(); } catch (\DownloadException $e) { $html = $e->formatMessage(); } catch (\Exception $e) { $ee = new \UserReportException(json_encode([ ERROR_MESSAGE_TO_USER => "Generic Exception: " . $e->getMessage(), ERROR_MESSAGE_TO_DEVELOPER => $e->getTraceAsString()]), E_ERROR); $html = $ee->formatMessage(); } catch (\Throwable $e) { $ee = new \UserReportException(json_encode([ ERROR_MESSAGE_TO_USER => "Generic Error: " . $e->getMessage(), ERROR_MESSAGE_TO_DEVELOPER => $e->getTraceAsString()]), E_ERROR); $html = $ee->formatMessage(); } if (isset($e) && $e->getCode() == ERROR_QUIT_QFQ_REGULAR) { $flagOk = true; } if (!$flagOk) { $html = "<div class='alert alert-warning'>$html</div>"; } // Restore has to be outside of try/catch - E_NOTICE needs to unset for further T3 handling after an QFQ Exception. error_reporting($origErrorReporting); $this->view->assign('qfqOutput', $html); $content = $this->view->render(); return new HtmlResponse($content); } </pre> We see that the new Typo3 versions are waiting for returned HtmlResponse Objects. h3. 4. Services.yaml (necessary file) For correct qfqController handling and preventing use of ObjectManager (which is deprecated in T3 V12) a Services.yaml file is needed. Location for this file is to set in /typo3conf/ext/qfq/Configuration Content of the file: <pre> services: IMATHUZH\Qfq\Controller\QfqController: autowire: true autoconfigure: true public: false </pre> Cache should be flushed after creating Services.yaml: Admin Tools > Maintenance > Flush TYPO3 and PHP Cache (Flush cache). h3. 5. Felogin with Fluid Template The actually used login template from uzh_cd extension doesnt work for Typo3 V11. Newly a fluid template is required and login/logout are separately defined. Current solution to get it work is to write the templates named with Login.html and Logout.html. These two files needs to overwrite the existing ones under following directory: typo3/sysext/felogin/Resources/Private/Templates/Login The better solution would be using own path for the templates, which didnt work to me, but maybe it works for someone: <pre> plugin.tx_felogin { view { templateRootPaths { 100 = EXT:uzh_cd_template/Resources/Private/Templates } } } </pre> Template files with content for the default fluid versions of the uzh templates are uploaded here and should match the old design (little bit specified for the geolean tool, do your own changes). Its not dynamically customizable over Typo3 Backend like the old template. Examples of currently not working typoScript configurations for felogin: * Linking own template * Using own message wraps commands like this one: plugin.tx_felogin_pi1.errorMessage_stdWrap.wrap = h3. 6. Custom CSS Files The given token 'cd.stylesheet =' from uzh_cd extension would not work correctly anymore with relative paths in newer Typo3 versions. The reason are used pageSlugs, which changes the path for the given custom CSS in every visited page. Example results with used TypoScript config: cd.stylesheet = fileadmin/templates/custom.css: Working version: <pre> Typo3 V8 with index.php and example page www.domain.com/index.php?id=10 -> www.domain.com/fileadmin/templates/custom.css </pre> Not working version: <pre> Typo3 V11 with pageSlug and example page www.domain.com/subpage -> www.domain.com/ *subpage* /fileadmin/templates/custom.css </pre> Solution: Use absolute paths for custom files in cd.stylesheet option.