Project

General

Profile

Actions

Typo3 V10 > V11 » History » Revision 11

« Previous | Revision 11/22 (diff) | Next »
Enis Nuredini, 13.04.2023 09:59


Migration Typo3 v10 > v11

Some changes in php are needed to get QFQ work in v11.

1. Extensions Upgrades

Extension Version
LDAP V3.7.1

2. File ext_localconf.php

The configurePlugin block needs to be changed to following:

\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
);

3. QFQ Class QfqController.php

Two new needed Classes needs to be linked:

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\HtmlResponse;

Changes for the showAction() function:

    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);
    }

We see that the new Typo3 versions are waiting for returned HtmlResponse Objects.

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:

services:
  IMATHUZH\Qfq\Controller\QfqController:
    autowire: true
    autoconfigure: true
    public: false

Cache should be flushed after creating Services.yaml: Admin Tools > Maintenance > Flush TYPO3 and PHP Cache (Flush cache).

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:

plugin.tx_felogin {
    view {
        templateRootPaths {
            100 = EXT:uzh_cd_template/Resources/Private/Templates
        }
    }
}

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 =

Updated by Enis Nuredini about 1 year ago · 11 revisions