Issue Bug Resolved

#111054Problem on https://docs.typo3.org/c/typo3/cms-dashboard/12.4/en-us/Developer/WidgetImplementation.html

Thomas Rawiel 10/14/26, 13:10 updated 10/16/26, 14:30

Description

https://docs.typo3.org/permalink/typo3-cms-dashboard:widget-php-class

The constructor of the example class, especially the used class for $cache is a little bit misleading/ confusing in my opinion:

class RssWidget implements WidgetInterface, RequestAwareWidgetInterface
{
    private ServerRequestInterface $request;

    public function __construct(
        private readonly WidgetConfigurationInterface $configuration,
        private readonly Cache $cache,
        private readonly BackendViewFactory $backendViewFactory,
        private readonly ButtonProviderInterface $buttonProvider = null,
        private readonly array $options = []
    ) {
    }

The original source in typo3/cms-dashboard has the following use statement:

use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface as Cache;

So the actual class used is TYPO3\CMS\Core\Cache\Frontend\FrontendInterface

I would suggest replacing the Cache class in the example’s constructor with the actual class TYPO3\CMS\Core\Cache\Frontend\FrontendInterface, like this has already been fixed in the typo3/cms-dashboard RssWidget class from version 13

(or add the use statements)

Reviews 3

History 36

  1. Thomas Rawiel commented 10/14/26, 13:16

    Also, in the documentation for TYPO3 12

     private readonly ButtonProviderInterface $buttonProvider = null,

    will produce a php error like

    PHP Fatal error:  Cannot use null as default value for parameter $buttonProvider of type TYPO3\CMS\Dashboard\Widgets\ButtonProviderInterface

    Should be

    private readonly ?ButtonProviderInterface $buttonProvider = null,

    like in the documentation for TYPO3 13 and up of this page

  2. Garvin Hicking changed status New Accepted TYPO3 Version 12 13 Complexity easy Sprint Focus On Location Sprint 10/15/26, 08:05

  3. Gerrit Code Review pushed patch set 1 for main to change 96736 status Accepted Under Review 10/15/26, 18:14

  4. Gerrit Code Review pushed patch set 1 for 14.3 to change 96756 10/16/26, 13:44

  5. Gerrit Code Review pushed patch set 1 for 13.4 to change 96757 10/16/26, 13:45

  6. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 10/16/26, 14:30

    Applied in changeset commit:9715742e043f874e1968fcc17da6a9ed73d77a09.