96348[FEATURE] Add identifiers for DocHeader buttons
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 2
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/48/96348/2 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/48/96348/2 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V 0 Needs a vote
- core-ci +1 CI
Merge conflicts 13
- main 97304[WIP][BUGFIX] Render the record form from unsaved values
- main 95916[BUGFIX] Render backend action buttons as HTML buttons
- main 91093[BUGFIX] Add accessible relation between dropdown and its toggle
- main 96543[WIP][POC][TASK] Write and read records by the same rules and rights
- main 95145[TASK] Migrate LanguageService->sL() labels to new domain syntax
- main 95278[FEATURE] Add event to render content around record edit form
- main 94653[WIP] Record Identity
- main 92943[WIP][TASK] Deprecate inline language labels (TYPO3.lang)
- main 92959[WIP][TASK] Use ICU message format for pluralization
- main 91425[TASK] Remove redundant titles from buttons
- main 91414[TASK] Generalize component conversion of button to dropdown item
- main 91020[TASK] Support late static binding in return types of abstract classes
- main 80380[WIP][TASK] Sync navigation component context
Issues 1
Files 16
- typo3/sysext/backend/Classes/Controller/EditDocumentController.php+10 −10
- typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php+5 −2
- typo3/sysext/backend/Classes/Template/Components/Buttons/AbstractButton.php+3 −1
- typo3/sysext/backend/Classes/Template/Components/Buttons/DropDownButton.php+3 −1
- typo3/sysext/backend/Classes/Template/Components/Buttons/FullyRenderedButton.php+3 −1
- typo3/sysext/backend/Classes/Template/Components/Buttons/GenericButton.php+3 −1
- typo3/sysext/backend/Classes/Template/Components/Buttons/IdentifiableButtonInterface.phpnew+31 −0
- typo3/sysext/backend/Classes/Template/Components/Buttons/IdentifiableButtonTrait.phpnew+37 −0
- typo3/sysext/backend/Classes/Template/Components/ModifyButtonBarEvent.php4+80 −6
- typo3/sysext/backend/Tests/Unit/Template/Components/ModifyButtonBarEventTest.phpnew+111 −0
- typo3/sysext/core/Documentation/Changelog/15.0/Feature-87694-IdentifiersForDocHeaderButtons.rst2new+86 −0
- typo3/sysext/redirects/Classes/EventListener/QrCodeNewDocHeaderButton.php+2 −4
- typo3/sysext/redirects/Classes/EventListener/ShortUrlNewDocHeaderButtonEventListener.php+2 −4
- typo3/sysext/redirects/Tests/Functional/EventListener/NewDocHeaderButtonTest.phpnew+73 −0
- typo3/sysext/scheduler/Classes/EventListener/ReplaceAddNewButtonToFormEngine.php+5 −14
- typo3/sysext/scheduler/Tests/Functional/EventListener/ReplaceAddNewButtonToFormEngineTest.phpnew+68 −0
Review log 57
-
Georg Ringer uploaded patch set 1 10/03/26, 07:59
-
Georg Ringer commented on patch set 1 10/03/26, 08:01
This change is ready for review. -
core-ci voted on patch set 1 V +1 10/03/26, 08:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110033
-
Oli Bartsch commented on patch set 1 10/05/26, 07:26
Hey, thats a nice feature. I actually was annoyed of this array matching when I built the CompnentFactory. However, My main concern is that the array key serves as the button's identity. That changes the shape of the `getButtons()` payload, so listeners and overridden DocHeader partials that still read `[group][0]` now break silently, and the patch is currently not declared as breaking. What about putting the identifier on the button instead? That would mean an optional `IdentifiableButtonInterface` plus a trait with getIdentifier()/setIdentifier(), which is what #87694 originally asked for. The groups would stay list, the template change goes away, nothing breaks, and ComponentFactory::createSaveButton()/createCloseButton() could set save/close for every module that uses them. The cost is applying the trait to the five ButtonInterface implementations. If you keep the array-key approach, the commit needs [!!!] and a Breaking RST.ButtonBar.php:110The group type changes from list<ButtonInterface> to array<int|string, ButtonInterface>. That's a change to the public shape of the ModifyButtonBarEvent payload: a listener that does $buttons['left'][2][0] (save) or [4][0] (new) on the record edit form now silently does nothing. Core used that exact pattern in EXT:redirects, so extensions have probably copied it.ButtonBar.php:172Re-adding an existing identifier removes the button and appends it at the end of its group, so its position inside the group changes. ModifyButtonBarEvent::setButton() replaces in place instead. Should both "replace" paths behave the same?ButtonBar.php:235This duplicates the check in validateIdentifier().ModifyButtonBarEvent.php:56Identifiers are scoped per ButtonBar, but listeners run for every module. Once other modules register new or delete, a listener calling removeButton('delete') hits all of them. Please either namespace the identifiers (e.g. record_edit.new) or make the example check the route first, as the scheduler listener does.ModifyButtonBarEvent.php:123setButton() skips what addButton() guarantees: there's no isValid() check, no clone, and PositionInterface is ignored. Two ways of adding a button with different rules will surprise people.Feature-87694-IdentifiersForDocHeaderButtons.rst:56This replaces "new" in every module. Please add the route check (record_edit) so people don't copy the unsafe version. -
Georg Ringer uploaded patch set 2
V +111/03/26, 20:37 -
Georg Ringer commented on patch set 2 11/03/26, 20:37
Reply
DoneButtonBar.php:110ReplyDoneButtonBar.php:172ReplyDoneButtonBar.php:235ReplyDoneModifyButtonBarEvent.php:56ReplyDoneModifyButtonBarEvent.php:123ReplyDoneFeature-87694-IdentifiersForDocHeaderButtons.rst:56ReplyDone -
core-ci voted on patch set 2 V +1 11/03/26, 20:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113226