Custom reports registration
The only report provided by the TYPO3 core is the one called Status.
The status report itself is extendable and shows status messages like a system environment check and the status of the installed extensions.
Reports and status are automatically registered through the service configuration, based on the implemented interface.
Register a custom report
Create a custom submodule extending the reports module.
<?php
return [
'system_reports_myreport' => [
'parent' => 'system_reports',
'access' => 'admin',
'path' => '/module/system/reports/myreport',
'iconIdentifier' => 'my-report-icon',
'labels' => [
'title' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:myreport.title',
'description' => 'LLL:EXT:my_extension/Resources/Private/Language/locallang.xlf:myreport.description',
],
'routes' => [
'_default' => [
'target' => \Vendor\MyExtension\Controller\MyReportController::class . '::handleRequest',
],
],
],
];
Implement the logic into your class:
<?php
declare(strict_types=1);
namespace MyVender\MyExtension\Reports;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Attribute\AsController;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
#[AsController]
final readonly class MyReportController
{
public function __construct(
protected ModuleTemplateFactory $moduleTemplateFactory,
) {}
public function handleRequest(ServerRequestInterface $request): ResponseInterface
{
$view = $this->moduleTemplateFactory->create($request);
$view->makeDocHeaderModuleMenu();
$view->assign('data', $this->collectReportData());
return $view->renderResponse('MyReport');
}
}
Use a template like below:
<html
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>
<f:layout name="Module"/>
<f:section name="Content">
<h1>My report</h1>
<p>Report it!</p>
</f:section>
</html>
Register a custom status
All status providers must implement
\TYPO3\CMS\Reports\StatusProviderInterface.
If
autoconfigure is enabled in Services.,
the status providers implementing this interface will be automatically
registered.
services:
_defaults:
autoconfigure: true
Alternatively, one can manually tag a custom report with the
reports. tag: