91231[!!!][TASK] Modernize backend template components API
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Garvin Hicking +1
- Sven Liebert +1
-
Verified V +2 Done
- Oli Bartsch +2
- Garvin Hicking +1
- Sven Liebert +1
- core-ci +1 CI
Issues 1
Files 38
- Build/phpstan/phpstan-baseline.neon+0 −12
- typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php6+37 −88
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/AbstractDropDownItem.php+49 −13
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownDivider.php+3 −3
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownHeader.php+7 −9
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownItem.php+9 −19
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownItemInterface.php+14 −6
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownRadio.php3+13 −26
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDown/DropDownToggle.php2+9 −23
- typo3/sysext/backend/Classes/Template/Components/Buttons/AbstractButton.php+26 −58
- typo3/sysext/backend/Classes/Template/Components/Buttons/ButtonInterface.php+12 −24
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDownButton.php+38 −48
- typo3/sysext/backend/Classes/Template/Components/Buttons/FullyRenderedButton.php2+21 −51
- typo3/sysext/backend/Classes/Template/Components/Buttons/GenericButton.php+76 −26
- typo3/sysext/backend/Classes/Template/Components/Buttons/InputButton.php2+36 −94
- typo3/sysext/backend/Classes/Template/Components/Buttons/LinkButton.php2+35 −79
- typo3/sysext/backend/Classes/Template/Components/Buttons/PositionInterface.php+45 −7
- typo3/sysext/backend/Classes/Template/Components/Buttons/SplitButton.php6+100 −90
- typo3/sysext/backend/Classes/Template/Components/Buttons/SplitButtonItems.phpnew+51 −0
- typo3/sysext/backend/Classes/Template/Components/Menu/Menu.php+73 −86
Show 18 more files
- typo3/sysext/backend/Classes/Template/Components/Menu/MenuItem.php2+40 −60
- typo3/sysext/backend/Classes/Template/Components/MultiRecordSelection/Action.php2+30 −6
- typo3/sysext/backend/Classes/Template/Components/AbstractControl.php+38 −55
- typo3/sysext/backend/Classes/Template/Components/ButtonBar.php10+181 −81
- typo3/sysext/backend/Classes/Template/Components/ComponentFactory.phpnew+196 −0
- typo3/sysext/backend/Classes/Template/Components/ComponentInterface.phpnew+56 −0
- typo3/sysext/backend/Classes/Template/Components/DocHeaderComponent.php4+91 −45
- typo3/sysext/backend/Classes/Template/Components/MenuRegistry.php+48 −22
- typo3/sysext/backend/Classes/Template/Components/ModifyButtonBarEvent.php+41 −1
- typo3/sysext/backend/Tests/Functional/Template/Components/ComponentFactoryTest.phpnew+135 −0
- typo3/sysext/backend/Tests/Unit/Template/Components/Menu/MenuItemTest.php+4 −4
- typo3/sysext/backend/Tests/Unit/Template/Components/MenuTest.php+2 −2
- typo3/sysext/core/Documentation/Changelog/14.0/Breaking-107823-StrictTypingAndAPICleanupInBackendTemplateComponents.rstnew+174 −0
- typo3/sysext/core/Documentation/Changelog/14.0/Deprecation-107824-ButtonBarMakeMethods.rstnew+161 −0
- typo3/sysext/core/Documentation/Changelog/14.0/Feature-107794-ImprovedBreadcrumbComponent.rst+88 −4
- typo3/sysext/core/Documentation/Changelog/14.0/Feature-107824-ComponentFactoryForBackendComponents.rst7new+212 −0
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php+70 −0
- typo3/sysext/scheduler/Classes/EventListener/ReplaceAddNewButtonToFormEngine.php+9 −5
Review log 3649
Show 1824 earlier messages
-
Oli Bartsch uploaded patch set 1 10/23/25, 22:45
-
core-ci voted on patch set 1 V -1 10/23/25, 22:52 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87451
-
Oli Bartsch uploaded patch set 2
V -110/24/25, 06:33 -
core-ci voted on patch set 2 V +1 10/24/25, 06:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87466
-
Garvin Hicking wrote 10/24/25, 08:57
Topic set to buttonbar -
Benni Mack commented on patch set 2 10/24/25, 09:18
ButtonBar.php:182we should deprecate these methods in the next patch in favor of newly created Factory. cc @garvin@hick.ing -
Oli Bartsch uploaded patch set 3
V +110/24/25, 09:24 -
core-ci voted on patch set 3 V -1 10/24/25, 09:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87478
-
Oli Bartsch uploaded patch set 4
V -110/24/25, 09:49 -
core-ci voted on patch set 4 V +1 10/24/25, 09:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87481
-
Oli Bartsch uploaded patch set 5
V +110/24/25, 09:58 -
core-ci voted on patch set 5 V +1 10/24/25, 10:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87482
-
Oli Bartsch commented on patch set 5 10/24/25, 10:13
ButtonBar.php:182ReplyDone -
Garvin Hicking commented on patch set 5 10/24/25, 12:26
ButtonFactory.php:140Just to note this here, we could use named parameters here for this factory to make integration much shorter: ``` public function createInputButton( string $name = '', string $value = '', string $label = '', string $iconIdentifier = '', IconSize $iconSize = IconSize::SMALL ): InputButton { $button = $this->createLinkButton(); if ($iconIdentifier) { $button->setIcon($this->iconFactory->getIcon($iconIdentifier, $iconSize)) } if ($name) { $button->setName($name); } if ($value) { $button->setValue($value); } if ($label) { $button->setTitle($this->getLanguageService()->sL($label)); } return $button; } ``` In Bennis follow-up patch https://review.typo3.org/c/Packages/TYPO3.CMS/+/91116 this would allow RecordList/FileList to do things like: ``` $button = $this->ButtonFactory->createAction(name: 'Action', iconIdentifier: 'save-action'); ``` -
Garvin Hicking commented on patch set 5 10/24/25, 12:50
ButtonBar.php:187We could utilize the factory here as well?ButtonBar.php:202EventDispatcherInterface could use constructor DI here tooShortcutButton.php:166Use DI for this?ShortcutButton.php:219Would it be worth to also migrate the service-related makeInstance calls (PageRenderer, UriBuilder) to constructor DI, or side-effects?DropDownRadio.php:59Use constructor DI for this here?DropDownToggle.php:21unused, can be removed (probably due to the example code?)InputButton.php:92Would `static::class` be more compliant to the fluent API return types?SplitButton.php:102`@return this` could be removedSplitButton.php:219Could be removed, automatic inferenceDocHeaderComponent.php:111```suggestion public function setMetaInformation(array $metaInformation): void ```DocHeaderComponent.php:122Put into constructor DI?Action.php:78Just to be sure, we cannot use DI for this IconFactory because the inject* Methods do not work on non-autoconfigured objects, right? -
Oli Bartsch uploaded patch set 6
V +110/24/25, 12:58 -
Oli Bartsch commented on patch set 6 10/24/25, 12:59
ButtonFactory.php:140ReplyWhile implementing this, I actually decided against this. I have added the reasons to the commit message and also mention them in the rst. -
Garvin Hicking commented on patch set 6 10/24/25, 13:02
FullyRenderedButton.php:70Use static::class here?LinkButton.php:79(similar to the other notes, static::class?)SplitButton.php:145I think we should throw the runtimeexception before `new SplitButtonItems` after that `if` above for clarity.MenuItem.php:65```suggestion public function setActive(bool $active): static ``` -
core-ci voted on patch set 6 V +1 10/24/25, 13:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87499
-
Garvin Hicking commented on patch set 6 10/24/25, 13:11
ButtonFactory.php:140ReplyHm, I don't see it like that. I think we could offer this on-top and optionally. Especially dealing with getLanguageService() and iconFactory is really ugly. Compare: ``` $moduleLink = $this->ButtonFactory->createLink( name: 'Action', iconIdentifier: 'save-action', iconSize: IconSize::SMALL, label: 'some.label', data: ['customAttribute' => 'customValue'], hrefRoute: ['file_edit', $parameter] ); ``` with: ``` $moduleLink = $this->buttonFactory->createLinkButton() ->setHref((string)$this->uriBuilder->buildUriFromRoute('file_edit', $parameter)) ->setDataAttributes(['customAttribute' => 'customValue']) ->setShowLabelText(true) ->setTitle($this->getLanguageService()->sL('some.label')) ->setIcon($this->iconFactory->getIcon('file-edit', IconSize::SMALL)); ``` That is a monster with several dependencies you would need to inject. The arguments could all be left empty and then you receive an object that can still use fluent API if you prefer... -
Garvin Hicking commented on patch set 6 10/24/25, 13:13
ButtonFactory.php:140ReplyNote: I think this discussion does not need to take place in this patch here. We could merge this one and shift the discussion to a later time/patch. -
Garvin Hicking commented on patch set 6 10/24/25, 13:19
Feature-107824-ComponentFactoryForBackendComponents.rst:14Please reference the FQCN here, this makes the docs create proper referencesFeature-107824-ComponentFactoryForBackendComponents.rst:55```suggestion The corresponding :php:`ButtonBar::make*()` methods are now deprecated. ```Feature-107824-ComponentFactoryForBackendComponents.rst:161Maybe an alternative route to satisfy both needs is that we introduce more setters like: ``` setIconIdentifier() setLabel() ``` and those could internally use the DI components, and allow shorthand fluent API usage? Thank you for writing up such a detailed rationale. I should have read that before only the commit message, I'm sorry. -
Oli Bartsch uploaded patch set 7
V +110/24/25, 13:24 -
Oli Bartsch commented on patch set 6 10/24/25, 13:24
ButtonBar.php:187ReplyDoneButtonBar.php:202ReplyDoneShortcutButton.php:166ReplyDoneShortcutButton.php:219ReplyDoneButtonFactory.php:140ReplyMy main problems are (from rst): A parameter-based approach would require duplicating all button-specific configuration knowledge in both the button classes and the factory methods. This creates a maintenance burden where changes to a button's properties must be reflected in multiple locations. Different button types have vastly different configuration requirements. For example, InputButton needs name/value/form attributes, LinkButton needs href attributes, DropDownButton needs items, and SplitButton needs primary/secondary actions.DropDownRadio.php:59ReplyDoneDropDownToggle.php:21ReplyDoneFullyRenderedButton.php:70ReplyDoneInputButton.php:92ReplyDoneLinkButton.php:79ReplyDoneSplitButton.php:102ReplyDoneSplitButton.php:145ReplyDoneSplitButton.php:219ReplyDoneDocHeaderComponent.php:111ReplyDoneDocHeaderComponent.php:122ReplyDoneMenuItem.php:65ReplyDoneAction.php:78ReplyYes. Would result in ``` Cannot autowire service "TYPO3\CMS\Backend\Template\Components\MultiRecordSelection\Action": argument "$name" of method "__construct()" is type-hinted "string", you should configure its value explicitly. ```
-
Oli Bartsch uploaded patch set 8 10/24/25, 13:33
-
Oli Bartsch commented on patch set 8 10/24/25, 13:34
Feature-107824-ComponentFactoryForBackendComponents.rst:14ReplyDoneFeature-107824-ComponentFactoryForBackendComponents.rst:55ReplyDoneFeature-107824-ComponentFactoryForBackendComponents.rst:161ReplyThis would be a good approach. We would then however talk about injecting services in "DTOs", which is what I would call the button classes. -
core-ci voted on patch set 7 V -1 10/24/25, 13:34 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87501
-
Oli Bartsch uploaded patch set 9 10/24/25, 13:40
-
core-ci voted on patch set 8 V -1 10/24/25, 13:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87502
-
Oli Bartsch uploaded patch set 10 10/24/25, 13:44
-
Oli Bartsch commented on patch set 10 10/24/25, 13:45
ShortcutButton.php:166ReplyReverted as this does not properly work and such optimizations can be done separately.ShortcutButton.php:219ReplyReverted as this does not properly work and such optimizations can be done separately.DropDownRadio.php:59ReplyReverted as this does not properly work and such optimizations can be done separately. -
core-ci voted on patch set 9 V -1 10/24/25, 13:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87503
-
core-ci voted on patch set 10 V +1 10/24/25, 13:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87504
-
Garvin Hicking commented on patch set 10 CR +1 V +1 10/24/25, 13:59
Thank you! Really good stuff. You saved me several hours of work with this :-DButtonFactory.php:140ReplyAcknowledgedFeature-107824-ComponentFactoryForBackendComponents.rst:161ReplyUnderstood. Let's resolve this and face it in a distinct patch about this. -
Sven Liebert commented on patch set 10 CR +1 V +1 10/24/25, 14:12
Code looks nice now :) Thank you! -
Oli Bartsch uploaded patch set 11
CR +1V +110/24/25, 14:28 -
Oli Bartsch updated the commit message in patch set 12 10/24/25, 14:31
-
Sven Liebert voted on patch set 12 CR +1 V +1 10/24/25, 14:32
-
core-ci voted on patch set 11 V +1 10/24/25, 14:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87510
-
core-ci voted on patch set 12 V +1 10/24/25, 14:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87511
-
Oli Bartsch uploaded patch set 13
CR +1V +110/24/25, 14:48 -
Sven Liebert voted on patch set 13 CR +1 V +1 10/24/25, 14:51
-
Garvin Hicking commented on patch set 13 CR +1 V +1 10/24/25, 14:55
Shiny! -
core-ci voted on patch set 13 V +1 10/24/25, 14:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/87516
-
Markus Klein commented on patch set 12 10/24/25, 15:03
ButtonBar.php:130since this is a breaking change anyway: move these to an enum too? -
Garvin Hicking commented on patch set 13 10/24/25, 15:54
ButtonBar.php:130ReplyThe breaking changes are kind of "soft" as most of the API can be used without shuffling your feet. Replacing tbis one would requore code changes though. Elias also did a similar patch for this: https://review.typo3.org/c/Packages/TYPO3.CMS/+/89733 and I think this would make it harder for dual-core-version usages. -
Oli Bartsch commented on patch set 13 CR +2 V +2 10/24/25, 16:37
ButtonBar.php:130ReplyI did not migrate this to enum intentionally, because those constants are basically used everywhere and in so many custom extensions, dealing with backend modules. There is IMO not that much benefit. However I would not block any patch doing this, but I don't see it here. -
Oli Bartsch merged patch set 14 10/24/25, 16:37
-
Markus Klein commented on patch set 14 10/24/25, 18:17
ButtonBar.php:130ReplyRoger. ✔