Review main Merged

66899[FEATURE] Introduce API for the configuration module

Sebastian Michaelsen CR +2 V +2 Expert +1078 −237 updated 12/01/20, 14:27

Commit message

Instead of having a hardcoded list of "trees" available
in the configuration module a new API is introduced and
all existing tree functionalities are moved into separate
provider classes to use the new API.

Extension authors are now able to add their own providers
to expose their custom configuration in the module. It's
even possible now to disable existing providers shipped
by core or any third-party extension.

Each provider is therefore registered in the `Services.yaml`
of the specific extension by defining the provider class
to be used and adding the `lowlevel.configuration.module.provider`
tag with at least the unique `identifier` attribute.

All providers must then implement the new `ProviderInterface`
to ensure the module can acquire the necessary data to
display the tree and the module menu.

The registration also provides a ordering / sorting
functionality using the DependencyOrderingService.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Oli Bartsch +1
    • TYPO3com +1 CI

Issues 1

Files 22

Show 2 more files

Review log 2943

Show 1218 earlier messages
  1. Sebastian Michaelsen uploaded patch set 1 11/25/20, 14:40

  2. TYPO3com voted on patch set 1 V -1 11/25/20, 14:53 Completed build in 12m 32s on Wed, 25 Nov, 02:53 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7571

  3. Sebastian Michaelsen uploaded patch set 2 11/25/20, 15:11

  4. Mathias Brodala commented on patch set 2 11/25/20, 15:21

    I like the idea in general.

    ConfigurationTreeProviderInterface.php:20

    This can be skipped, providers do not need to worry about the specific rendering. Also this could be used in other locations without tree rendering.

    ConfigurationTreeProviderInterface.php:26

    No need to repeat the return type here. ;-)

    ConfigurationTreeProviderInterface.php:28

    Given this is a boolean it should say "sortKeys". But then again: why not leave this up to the provider?
  5. TYPO3com voted on patch set 2 V +1 11/25/20, 15:26 Completed build in 14m 36s on Wed, 25 Nov, 03:26 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7573

  6. Sebastian Michaelsen uploaded patch set 3 11/25/20, 15:44

  7. TYPO3com voted on patch set 3 V -1 11/25/20, 15:44 Completed build in 24s on Wed, 25 Nov, 03:44 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7574

  8. Sebastian Michaelsen commented on patch set 3 11/25/20, 15:45

    ConfigurationTreeProviderInterface.php:20 Reply

    You're right that the providers are independent from the rendering. I just felt that ConfigurationProviderInterface is a very generic name.

    ConfigurationTreeProviderInterface.php:26 Reply

    Ack

    ConfigurationTreeProviderInterface.php:28 Reply

    You're right. I removed the sorting feature from the interface. The providers now sort the data them themselves if applicable.
  9. Mathias Brodala commented on patch set 3 CR -1 11/25/20, 15:54

    Please drop the "Tree" from the class names as discussed. :-)

    ConfigurationTreeProviderInterface.php:20 Reply Unresolved

    I think that's fine, that's what the namespace is there for.
  10. Oli Bartsch commented on patch set 3 11/25/20, 15:56

    ConfigurationController.php:57

    This could heavily simplified using ServiceContainer and DI. So we don't have to use makeInstance by providing the Containe, get rid of the superglobals. This would also align the registration process according to latest introductions like the dashboard and allows better handling of the registered "providers". Thinking about it, there IMO two ways this could be achieved: 1. Leaving the configuration in the implementation classes - the providers, we could simply tag all classes which implement ConfigurationTreeProviderInterface and then register them in a registry through a CompilerPass. 2. Moving the configuration in a Services.(yaml|php) and manually tag all services there. The registration process then would be the same as in (1.) You can have a look at ext:extensionmanager which does exactly this kind of registration: - All "remotes" are defined in Services.yaml and tagged with "extension.remote". - In Services.php a compiler pass is registered for this tag - The compiler pass fetches the service definition for the tag and calls the "registerRemote" method of the "RemoteRegistry" which "registers" the given services. - The "RemoteRegistry" is just a simple storage object for all corresponding services and their configuration and provides multiple function (has, get, getAll, ..) to retrieve the registered services Please ping me on slack if you have any questions regarding this.
  11. Oli Bartsch commented on patch set 3 11/25/20, 15:59

    ConfigurationController.php:57 Reply Unresolved

    You can also have a look at the RST, explaining the registration for 3rd party: https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/master/Feature-92457-ImprovedExtensionRepositoryAPI.html
  12. Oli Bartsch uploaded patch set 4 11/25/20, 23:22

  13. TYPO3com voted on patch set 4 V -1 11/25/20, 23:23 Completed build in 21s on Wed, 25 Nov, 11:23 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7583

  14. Oli Bartsch uploaded patch set 5 11/25/20, 23:29

  15. Oli Bartsch uploaded patch set 6 11/25/20, 23:37

  16. TYPO3com voted on patch set 5 V -1 11/25/20, 23:41 Completed build in 11m 04s on Wed, 25 Nov, 11:41 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7584

  17. TYPO3com voted on patch set 6 V -1 11/25/20, 23:49 Completed build in 12m 27s on Wed, 25 Nov, 11:49 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7585

  18. Oli Bartsch commented on patch set 6 V -1 11/25/20, 23:56

    I just changed the registration method without touching the class structure in the first place. This however still needs some more adjustments which include the way the providers are implemented. There are now a lot of classes with empty body. Since they all do the same with just another identifier and another global variable key, this could be one class with multiple tags assigned (same tag name but other attributes). Similar to how multiple event listeners are registered for the same class. This class could then a $identifer and $configuration property. First is simply filled with the "identifier" attribute and the second with the array of the defined global variable. The providers which generate the configuration array themselves (e.g. SiteConfigurationProvider), using other services, could be register the same way but with an additional attribute (name tbd) which calls the assigned "implementation" class which just fills the $configuration property with a custom $configurationArray. So there will be less classes and the registration will even be more simplified. Second topic to think about are the "labels". We should try to remove them since they just duplicate the identifier. This would mean we either use the identifier and change the locallang keys, or we use the current label as new identifier. Therefore, a UpgradeWizard needs to fix the UC since the identifier is stored there.
  1. Oli Bartsch uploaded patch set 7 11/27/20, 15:04

  2. TYPO3com voted on patch set 7 V -1 11/27/20, 15:16 Completed build in 11m 26s on Fri, 27 Nov, 03:16 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7648

  3. Oli Bartsch uploaded patch set 8 11/27/20, 15:26

  4. TYPO3com voted on patch set 8 V +1 11/27/20, 15:37 Completed build in 11m 09s on Fri, 27 Nov, 03:37 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7650

  5. Oli Bartsch uploaded patch set 9 11/27/20, 17:53

  6. TYPO3com voted on patch set 9 V +1 11/27/20, 18:05 Completed build in 11m 23s on Fri, 27 Nov, 06:05 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7653

  7. Oli Bartsch uploaded patch set 10 11/27/20, 18:17

  8. TYPO3com voted on patch set 10 V +1 11/27/20, 18:28 Completed build in 10m 43s on Fri, 27 Nov, 06:28 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7655

  9. Daniel Haupt uploaded patch set 11 11/27/20, 21:55

  10. TYPO3com voted on patch set 11 V +1 11/27/20, 22:06 Completed build in 10m 59s on Fri, 27 Nov, 10:06 PM Test Summary: 32394 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7658

  11. Oli Bartsch uploaded patch set 12 11/30/20, 09:21

  12. TYPO3com voted on patch set 12 V +1 11/30/20, 09:33 Completed build in 11m 48s on Mon, 30 Nov, 09:33 AM Test Summary: 32404 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7691

  13. Christian Kuhn commented on patch set 12 11/30/20, 10:03

    Feature-92929-ExtendableConfigurationModule.rst:12

    it should be mentioned the backend 'Configuration' module is provided by the lowlevel extension.

    GlobalVariableProvider.php:70

    since the missing key would indicate a programmer error and not a user error, a generic top level exception that should never be caught should be thrown.

    Services.yaml:53

    since 'configuration' is such a generic term, it might be better to use 'configurationModule' ?

    Services.yaml:54

    similar here - maybe a better naming could be 'configurationModuleProvider' ?

    Services.yaml:56

    and here ;)
  14. Oli Bartsch commented on patch set 12 V -1 11/30/20, 12:00

    On it
  15. Oli Bartsch uploaded patch set 13 11/30/20, 13:49

  16. Oli Bartsch uploaded patch set 14 11/30/20, 13:56

  17. Oli Bartsch commented on patch set 14 11/30/20, 13:57

    Feature-92929-ExtendableConfigurationModule.rst:12 Reply

    Done

    GlobalVariableProvider.php:70 Reply

    Done

    Services.yaml:53 Reply

    Done

    Services.yaml:54 Reply

    Done

    Services.yaml:56 Reply

    Done
  18. TYPO3com voted on patch set 13 V +1 11/30/20, 14:00 Completed build in 11m 37s on Mon, 30 Nov, 02:00 PM Test Summary: 32405 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7699

  19. TYPO3com voted on patch set 14 V +1 11/30/20, 14:07 Completed build in 11m 03s on Mon, 30 Nov, 02:07 PM Test Summary: 32405 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-7700

  20. Mathias Brodala commented on patch set 14 11/30/20, 14:43

    GlobalVariableProvider.php:69

    I think referring to DI "tags" as attributes here will increase confusion so there should either be a well-documented encapsulation or a straightforward mention of DI "tags".
  21. Oli Bartsch commented on patch set 14 11/30/20, 15:05

    GlobalVariableProvider.php:69 Reply

    That's actually the correct term. It's an attribute of a service tag (See: https://symfony.com/doc/current/service_container/tags.html). This does not relate to DI in the first place. The need for those tag attributes is therefore mentioned in the rst.
  22. Mathias Brodala commented on patch set 14 11/30/20, 15:18

    GlobalVariableProvider.php:69 Reply

    Ah indeed. I missed that these attributes are set on the lone tag required for this change. That clears it up. :-)
  23. Oli Bartsch voted on patch set 14 V +1 CR +1 12/01/20, 14:26

  24. Christian Kuhn voted on patch set 14 V +2 CR +2 12/01/20, 14:27

  25. Christian Kuhn merged patch set 15 12/01/20, 14:27