Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.
82154[WIP][FEATURE] Simplify Extbase plugin configuration and registration
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 12
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/82154/12 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/54/82154/12 && git cherry-pick FETCH_HEAD
Review
-
Code review CR 0 Needs a vote
-
Verified V -1 Blocked
- core-ci -1 CI
Issues 1
Files 23
- typo3/sysext/core/Classes/Configuration/Extension/Plugin/PluginConfigurationContainerInterface.phpnew+36 −0
- typo3/sysext/core/Classes/Configuration/Extension/Plugin/PluginConfigurationInterface.phpnew+20 −0
- typo3/sysext/core/Classes/Configuration/Extension/Plugin/PluginFactory.phpnew+72 −0
- typo3/sysext/core/Classes/Configuration/Tca/TcaFactory.php+12 −0
- typo3/sysext/core/Classes/Core/BootService.php+2 −0
- typo3/sysext/core/Classes/Core/Bootstrap.php+2 −0
- typo3/sysext/core/Configuration/Services.yaml+3 −0
- typo3/sysext/core/Documentation/Changelog/13.0/Feature-102677-SimplifyExtbasePluginConfigurationAndRegistration.rstnew+79 −0
- typo3/sysext/extbase/Classes/Configuration/PluginConfiguration.phpnew+80 −0
- typo3/sysext/extbase/Classes/Configuration/PluginConfigurationContainer.phpnew+62 −0
- typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php14+1 −2
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/Extbase/Plugins.php2new+26 −0
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Configuration/TCA/Overrides/tt_content.php+1 −5
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/ext_localconf.php+1 −16
- typo3/sysext/felogin/Configuration/TCA/Overrides/tt_content.php+6 −13
- typo3/sysext/felogin/Configuration/Plugins.phpnew+32 −0
- typo3/sysext/felogin/ext_localconf.php+0 −17
- typo3/sysext/form/Configuration/TCA/Overrides/tt_content.php+3 −13
- typo3/sysext/form/Configuration/Plugins.phpnew+29 −0
- typo3/sysext/form/ext_localconf.php+0 −11
Review log 3446
Show 1421 earlier messages
-
Torben Hansen uploaded patch set 1 12/08/23, 18:14
-
core-ci voted on patch set 1 V -1 12/08/23, 18:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50512
-
Torben Hansen uploaded patch set 2
V -112/09/23, 11:33 -
core-ci voted on patch set 2 V +1 12/09/23, 11:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50524
-
Torben Hansen rebased onto patch set 3
V +112/14/23, 06:49 -
core-ci voted on patch set 3 V +1 12/14/23, 06:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50633
-
Torben Hansen uploaded patch set 4
V +112/15/23, 18:34 -
core-ci voted on patch set 4 V +1 12/15/23, 18:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50725
-
Christoph Lehmann commented on patch set 4 12/15/23, 20:51
Nice idea! Would be cool to get also rid of the manual call registerPlugin(), so that Plugins.php get loaded automatically. And might it be possible to register the FlexForm also within a plugin configuration in Plugins.php? Then we had one single place for all the plugin stuff. -
Oli Bartsch commented on patch set 4 12/15/23, 21:00
Funny, I just talked about this topic with Benni today. Actually our idea was to not just move configuration to a different file but to automate the registration, e.g. using PHP attributes. Another possibility would be an approach like this https://review.typo3.org/c/Packages/TYPO3.CMS/+/60904. What do you think? -
Garvin Hicking commented on patch set 4 12/15/23, 21:25
Reply
Also mentioned and thought about attributes, so I'd like to chime in $0.02. I initially disliked that this would then not have an easy central place to configure/find all the plugin configs and see what's cachable or not, what's a default and so on. Maybe we could either get an info module (like for middleware overview) then to expose all of it. OR the attributes could be evaluated, and create that Plugins.php file automatically. The file could take priority over evaluating attributes, if manually edited (or initially created, kind of like ext_tables.sql). (Personally, I do like the ability to mix&match controller actions to different plugins, and gives some nice flexibility, especially configuring different default actions per plugin with the same contorller. OTOH architecturally indeed it would make sense to advocate per-plugin-controllers instead) -
Torben Hansen commented on patch set 4 12/16/23, 06:28
Reply
The main idea is to have one single "source of truth" the plugin registration and configuration for extbase plugins. First step would be to simplify plugin registration and configuration in the suggested file. Next step would be to also add FlexForm and PlugPreview registration to that file. Using PHP attributes would IMO make it harder for extension authors to have an overview of, which actions a plugin currently use and if they are cached or uncached. Having a new module or CLI command, where extension authors would have a central overview of plugins, controllers and actions is IMO also not suitable, since this can be confusing on websites with a big extension stack (e.g. if extension authors have to scroll/filter for the current extension in order to get an overview). Automatically registering all public actions as callable is maybe also an option, but I think this is too breaking and a big conceptual change, since existing extensions will need bigger refactorings, if we define, that different plugins can not use the same controller any more. I'm open for discussions here, so maybe everyone interested in this topic could meet in a huddle.Reply
The main idea is to move the whole registration and configuration process for plugins to one file. This will at a later point also include FlexForm and PluginPreview configuratiuon. -
Christoph Lehmann commented on patch set 4 12/16/23, 12:12
Reply
Awesome, please go on! -
Oliver Klee voted on patch set 4 V +1 12/16/23, 12:31
-
Oliver Klee voted on patch set 4 V 0 12/16/23, 12:31
-
Torben Hansen uploaded patch set 5
V +112/23/23, 05:40 -
core-ci voted on patch set 5 V +1 12/23/23, 05:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50922
-
Torben Hansen uploaded patch set 6
V +101/13/24, 11:31 -
core-ci voted on patch set 6 V +1 01/13/24, 11:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51534
-
Torben Hansen uploaded patch set 7
V +101/13/24, 13:09 -
core-ci voted on patch set 7 V -1 01/13/24, 13:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51535
-
Torben Hansen uploaded patch set 8
V -101/13/24, 17:51 -
Torben Hansen wrote 01/13/24, 17:54
Topic set to extbase -
core-ci voted on patch set 8 V +1 01/13/24, 17:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51538
-
Simon Schaufelberger voted on patch set 8 CR +1 01/13/24, 20:26
-
Garvin Hicking commented on patch set 8 01/13/24, 20:34
Feature-102677-SimplifyExtbasePluginRegistration.rst:24:php:'EXT:felogin'?Feature-102677-SimplifyExtbasePluginRegistration.rst:46Maybe list different actions for cache and none-cacheable to not confuse readers? An action shouldn't be both?Feature-102677-SimplifyExtbasePluginRegistration.rst:57Mention somehow that similar code will likely exist, and is now moved to the distinct file, so it can be replaced with the new call? -
Oliver Klee commented on patch set 8 01/13/24, 23:16
ExtensionUtility.php:33`@param non-empty-string $extensionKey`ExtensionUtility.php:36```php if ($configuration === []) { ```ExtensionUtility.php:54`@param non-empty-string $extensionKey`ExtensionUtility.php:57```php if ($configuration === []) { ```ExtensionUtility.php:76Can we define the return value more specifically here using array shapes?ExtensionUtility.php:76`@param non-empty-string $extensionKey` -
Torben Hansen uploaded patch set 9
CR +1V +101/14/24, 10:53 -
Torben Hansen commented on patch set 8 01/14/24, 10:53
Reply
Finished the patch so far, so it may get more attention and can be reviewed/discussed.Feature-102677-SimplifyExtbasePluginRegistration.rst:24ReplyChanged to :php:`EXT:form`Feature-102677-SimplifyExtbasePluginRegistration.rst:46ReplyChanged the example to show EXT:form plugin registrationFeature-102677-SimplifyExtbasePluginRegistration.rst:57ReplyDoneExtensionUtility.php:33ReplyDoneExtensionUtility.php:36ReplyDoneExtensionUtility.php:54ReplyDoneExtensionUtility.php:57ReplyDoneExtensionUtility.php:76ReplyI think this does not suit here, since the returned structure will depend on which settings the extension author defines. Ist is e.g. possible to ommit e.g. `icon`, `group` or `description`.ExtensionUtility.php:76ReplyDone -
core-ci voted on patch set 9 V +1 01/14/24, 10:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/51553
-
Oliver Klee commented on patch set 9 01/14/24, 11:16
ExtensionUtility.php:48If we're not really sure about the format of the configuration, we'll need string casts or array type checks to avoid type errors. (The type error then will properly indicate that a configuration is invalid, but it will make it hard to track down what part of the configuration exactly is not valid.) Maybe we can also validate the configuration in `getPluginConfigurationFromFile` to make sure that the configuration is well-formed and well-typed and throw an exception with a meaningful message instead. What do you think? -
Oliver Klee commented on patch set 9 01/14/24, 12:13
Plugins.php:16I'm not a big fan (anymore) of array-based configuration formats as they provide little guidance and type-safety for the developer using them. As we're creating this concept here, maybe we can use a simple DTO class instead of the array. What do you think? (I'd also be willing to build it.) -
Torben Hansen commented on patch set 9 01/14/24, 12:43
ExtensionUtility.php:48ReplyIMO this will result in much more code (and code to test) for validating the configuration. We focus on developers here, so they should be able to read the stack trace, which clearly shows, where the type error occured and what data was given. We basically have the same "problems" other places in core (e.g. inclusion of Extbase/Persistence/Classes, Services.yaml, Sites config, etc.) which all throw hard exceptions if given format is not as expected. If the patch comes in, I'm willing to invest some more hours in work on creating a test covered validation for the configuration file to make life more comfortable for non-experienced developers. But at the current state, I prefer to keep things as they are.Plugins.php:16Reply UnresolvedIn general I thought about a DTO here too, but think array-based PHP files do fine here, as Extbase/Persistence/Classes.php also use it. In core we currently have many configuration options like PHP files, which return arrays (e.g. TCA, Classes.php, JavaScript Modules), YAML files, XML for FlexForm and PHP files with a return a function (Services.php). Now introducing another format of configuration (PHP file which returns a DTO) is IMO something new that should be discussed in the Core team before it gets introduced. -
Stefan Bürk commented on patch set 9 CR -1 01/17/24, 02:18
-1 as this patch needs additional work. I had a call with Torben about some things. - `Simplify` does not really match here. Data is combined in one place, but still registration needs to be done on two places by the extension author. This should be really simplified that the configurations are collected (and cached) - and the core should than use these information at the proper places to provide the configure/registration calls. - I'd say that we should normalize this and use it for plugin and extbase plugin registration. Instead of having later 2 files to handle for similar things. - on a longer turn, I would say more things could be available in the simplified registration, for example a option to add a flexform definition file (removing addition code from `Configuration/TCA/Overrides/tt_content.php` - Oliver mentioned DTO instead of array configuration. I talked with Torben about it, personally I would love to see to use kind of DTO/Builder classes in that configuraiton file, enforcing to have a collection (ExtensionPluginRegistrationCollection) and items, with some interfaces and blabla. But as Torben already answered, beside my personal thinking here this should be discussed in a broader round first. Torben will try to work on the things, and I will try to support him but I assume not finding time before 13.0 due to other things on the plate. However, this is a FEATURE so it does not really need to be in 13.0 as long as questions are open. Thanks Torben for the productive call and the kickoff of this thing (had something the same topic in mind already in mind for later 13.x). -
Garvin Hicking commented on patch set 9 01/17/24, 06:35
Reply
Thanks for the update on it, looking forward to the implementation. About DTO, the CSP builder could be mentioned: https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentSecurityPolicy/Index.html#policy-builder-approach Personally I am used to the TCA/Array approach and find it easy to read and extend, and be managed by integrators (even though this config is not TCA, I know). My feeling is that integrators shy away from CSP-like configuration. And those people will probably later also integrate extbase plugin configs, not only developers? CSP does provide a YAML alternative, so I'm wondering if we would need that here too, if it gets implemented as a builder interface - on the other hand, plugin configs are usually not changed unless part of sitepackages, so it is a different domain than CSP... hm. I do see the benefits of a good definition and "sane" management of the interface. But migration overhead instead of nearly copy+paste of the old config is also a benefit for people, and might hinder v13 adoption of existing public extensions. I'm a bit torn, so I'm curious how others feel. -
Torben Hansen marked it work in progress 01/17/24, 06:44
-
Torben Hansen commented on patch set 9 01/17/24, 06:46
This change is ready for review.Reply
If it should be YAML, I will not work on this patch any more and abandon it ;-) But to be honest, if we should provide an alternative, we first need "something" globally to handle those multiple config file aproaches globally - elsewise we end up in duplicate code all over. But lets not discuss this topic it this issue, since it is the wrong place and moves the focus away from the feature I'll try to implement. If someone wants to work on this topic (generalized configuration management), I suggest to create a new issue or discussion for it. Now, I set this patch to WIP and will postpone work on it. Most important task will be to ommit the calls in ext_localconf.php and TCA overrides. -
Torben Hansen marked it work in progress 01/17/24, 06:46
-
Simon Schaufelberger commented on patch set 9 01/17/24, 08:53
Reply Unresolved
the migration can easily be done with a rector rule by the way. -
Torben Hansen uploaded patch set 10
CR -1V +102/03/24, 12:50 -
core-ci voted on patch set 10 V +1 02/03/24, 12:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52659
-
Torben Hansen uploaded patch set 11
V +102/03/24, 18:51 -
Torben Hansen updated the commit message in patch set 12 02/03/24, 18:52
-
core-ci voted on patch set 11 V -1 02/03/24, 18:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52662
-
core-ci voted on patch set 12 V -1 02/03/24, 18:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/52663
-
Benni Mack commented on patch set 12 02/05/24, 19:58
I'm not too sure about this. I do think we should look into some details about the registration to sort out the registration in general. IN addition, there was a change from Alex about dropping the controller actions in Plugins (see https://review.typo3.org/c/Packages/TYPO3.CMS/+/60904) I think we should reach out to him and find out his motivation in more detail.