Breaking: #97320 - Register Report and Status via Service Configuration

See forge#97320

Description

The reports and status in EXT:reports are now registered via service configuration, see the feature changelog. Therefore the registration via $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] has been removed.

Additionally, to be able to use autoconfiguration, the following interfaces have been extended:

  • TYPO3\CMS\Reports\ReportInterface: getIdentifier, getIconIdentifier, getTitle, getDescription

  • TYPO3\CMS\Reports\StatusProviderInterface: getLabel

Impact

Registration of custom reports via $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] are not evaluated anymore.

Registration of custom status via $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers'] are not evaluated anymore.

ReportInterface and StatusProviderInterface: are extended by the mentioned methods. If the required methods are not implemented it will lead to fatal errors.

Affected Installations

All TYPO3 installations using the old registration.

All TYPO3 installations with custom reports, not implementing public function getIdentifier(), public function getIconIdentifier(), public function getTitle(), public function getDescription()

All TYPO3 installations with custom status, not implementing public function getLabel()

Migration

By implementing the required methods of the interfaces, the custom reports are fully backwards compatible.

If TYPO3 v12+ is the only supported version, the configuration $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] from the ext_localconf.php file can be removed as well.

Report

If autoconfigure is not enabled in your Configuration/Services.(yaml|php), add the tag reports.report manually to your reports service.

Vendor\Extension\Report\MyReport:
  tags:
    - name: reports.report

The old registration can be removed, if support for TYPO3 v11 or lower is not necessary.

// Before in ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['extension']['general'] = [
    'title' => 'LLL:EXT:extension/Resources/Private/Language/locallang.xlf:title',
    'description' => 'LLL:EXT:extension/Resources/Private/Language/locallang.xlf:description',
    'icon' => 'EXT:extension/Resources/Public/Icons/Extension.svg',
    'report' => \Vendor\Extension\Report::class
];

Additionally, make sure to implement all methods of TYPO3\CMS\Reports\ReportInterface.

// Changes for the report

class Report implements ReportInterface
{
    public function getReport(): string
    {
        return 'Full report';
    }

    public function getIdentifier(): string
    {
        return 'general';
    }

    public function getTitle(): string
    {
        return 'LLL:EXT:extension/Resources/Private/Language/locallang.xlf:title';
    }

    public function getDescription(): string
    {
        return 'LLL:EXT:extension/Resources/Private/Language/locallang.xlf:description';
    }

    public function getIconIdentifier(): string
    {
        return 'module-reports';
    }
}

Refer to the Icon API on how to register the icon.

Status

If autoconfigure is not enabled in your Configuration/Services.(yaml|php), add the tag reports.status manually to your status service.

Vendor\Extension\Status\MyStatus:
  tags:
    - name: reports.report

The old registration can be removed, if support for TYPO3 v11 or lower is not necessary.

// Before in ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['label'] = [
    \Vendor\Extension\Status::class,
];

Additionally, make sure to implement all methods of TYPO3\CMS\Reports\StatusProviderInterface.

// Changes for the Status

class Status implements StatusProviderInterface
{
    public function getStatus(): array
    {
        return [];
    }

    public function getLabel(): string
    {
        return 'label';
    }
}