Review main Abandoned Breaking

74435[!!!][FEATURE] Add PSR-14 IncludeStaticTypoScriptSources events

crell CR 0 V 0 Hard +263 −54 updated 05/22/22, 07:26

Commit message

This introduces two new PSR-14 events, enabling
extension authors to modify the list of static
template files to be included in TypoScript.

This replaces the previously available hooks
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSources']
and
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['includeStaticTypoScriptSourcesAtEnd']
which are therefore now removed.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 10

Review log 1520

  1. crell uploaded patch set 1 04/26/22, 17:54

  2. crell uploaded patch set 2 04/26/22, 17:55

  3. core-ci voted on patch set 2 V -1 04/26/22, 18:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26465

  4. core-ci voted on patch set 1 V -1 04/26/22, 18:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26464

  5. crell uploaded patch set 3 04/26/22, 20:58

  6. core-ci voted on patch set 3 V +1 04/26/22, 21:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26482

  7. Stefan Bürk commented on patch set 3 04/27/22, 01:42

    IncludeStaticTypoScriptSourcesBeforeEvent.php:7

    Events in core are final. Should be added.

    IncludeStaticTypoScriptSourcesBeforeEvent.php:26 Unresolved

    Core way for events are protected/private properties and providing corresponding getter/setters for the properties (setters only if needed to be set by event listeners). This is also valid if CPP is used. Do not add them as public properties. Please change accordingly.

    IncludeStaticTypoScriptSourcesEndEvent.php:7

    Events in core are final. Should be added.

    IncludeStaticTypoScriptSourcesEndEvent.php:21 Unresolved

    Core way for events are protected/private properties and providing corresponding getter/setters for the properties (setters only if needed to be set by event listeners). This is also valid if CPP is used. Do not add them as public properties. Please change accordingly.

    TemplateService.php:710

    Sounds little bit weired. Do you think we can use here something which really describes that this is before including static typo script sources - and let it not sounding like "before event" ? Would would you say to "BeforeIncludeStaticTypoScriptSourcesEvent" ?

    TemplateService.php:770 Unresolved

    Sounds little bit weired. Do you think we can use here something which really describes that this is before including static typo script sources - and let it not sounding like "end event" ? Additionally, can we considir to use at least "after" instead of "end" ? Thinking of, old hook way using "pre" for before and "post" for after sounds more familar - what do you think ? Given the old used "hook" names, this shoudl be at least IncludeStaticTypoScriptSourcesAtEndEvent

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:22

    Seems likly odd ...

    ContentObjectRendererTest.php:170

    Don't you think this variable name may be missleading if only reading the latest usage in the method ? Maybe we should name it more clearly as $noopEventDispatcher, would this be fine with you ?

    NoopEventDispatcher.php:9

    Please add a little description. The code is mainly "useless" if not explained that this may or can be used in unit tests as noop event dispatcher mock or anon classes. Let it now here - but would have been nice to introduce this in a dedicated pre-patch and self contained. Instead of a silent unexplained side-kick.
  8. Mathias Brodala commented on patch set 3 04/27/22, 06:51

    IncludeStaticTypoScriptSourcesBeforeEvent.php:7

    How about BeforeStaticTypoScriptIncludesEvent?

    IncludeStaticTypoScriptSourcesEndEvent.php:7 Unresolved

    How about AfterStaticTypoScriptIncludesEvent?
  9. Oli Bartsch commented on patch set 3 CR -1 04/27/22, 10:24

    IncludeStaticTypoScriptSourcesBeforeEvent.php:4

    Copyright comment missing

    IncludeStaticTypoScriptSourcesBeforeEvent.php:6

    Class comment missing

    IncludeStaticTypoScriptSourcesEndEvent.php:4

    Copyright comment missing

    IncludeStaticTypoScriptSourcesEndEvent.php:6

    Class comment missing

    TemplateService.php:708 Unresolved

    Since TemplateService is public, such change might be breaking and should therefore be documented.

    TemplateService.php:712 Unresolved

    Core Events usually use getters to access the (modified) properties.

    TemplateService.php:770 Unresolved

    This event seems to be quite useless now. The (modified) properties are never used and the TemplateService instance is no longer available by the subscribers.

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:4

    This seems to be not the correct title.

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:18 Unresolved

    This rst currently does not describe a new feature. Readers will not know what they can do and how. So let's elaborate the purpose of those events and also name the available properties/methods.

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:41

    Could we please add an example usage here. "Somehow" sounds like we do not know what to do with this event ourselfs. Additionally two events are added, which should both be described here.

    NoopEventDispatcher.php:4

    Copyright comment missing

    NoopEventDispatcher.php:5

    Could we move this into some fixture namespace?
  10. crell commented on patch set 3 04/27/22, 18:32

    IncludeStaticTypoScriptSourcesBeforeEvent.php:4 Reply

    Ack

    IncludeStaticTypoScriptSourcesBeforeEvent.php:6 Reply

    Ack

    IncludeStaticTypoScriptSourcesBeforeEvent.php:7 Reply

    Done

    IncludeStaticTypoScriptSourcesBeforeEvent.php:7 Reply Unresolved

    No strong preference. I was going for something that most closely matched the old hook name while still being reasonably descriptive. I'm good with whatever the consensus is.

    IncludeStaticTypoScriptSourcesEndEvent.php:4 Reply

    Done

    IncludeStaticTypoScriptSourcesEndEvent.php:6 Reply

    Done

    IncludeStaticTypoScriptSourcesEndEvent.php:7 Reply

    Done

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:4 Reply

    Gr. Git screw up I didn't catch. Thanks.

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:22 Reply

    Done

    Feature-97453-PSR-14EventForIncludingStaticTypoScriptSources.rst:41 Reply Unresolved

    To be honest, I don't fully understand what those hooks were doing as core has no examples that I found. I welcome feedback here because I'm not sure what you're supposed to do with them. The events should be a direct 1-1 replacement.

    ContentObjectRendererTest.php:170 Reply

    Eh, no strong feeling either way, other than the tendency in core to err too far on the side of super-long variable names. :-) How about $mockDispatcher?

    NoopEventDispatcher.php:4 Reply

    Done

    NoopEventDispatcher.php:5 Reply

    It didn't really seem like a Fixture, but I checked and the only thing in the Unit/Fixtures directory right now is also a mock like this, it looks like, so, meh. I'll move it in there.

    NoopEventDispatcher.php:9 Reply

    Done
  11. crell uploaded patch set 4 04/27/22, 18:32

  12. core-ci voted on patch set 4 V +1 04/27/22, 18:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26534

  13. Simon Schaufelberger commented on patch set 4 04/28/22, 01:03

    TemplateService.php:288

    please keep the order of the method parameters with the assigned variables
  14. crell commented on patch set 4 04/28/22, 13:53

    TemplateService.php:288 Reply

    Done

    TemplateService.php:710 Reply Unresolved

    As above, I don't have a strong feeling about the names here so I'm good with whatever; I don't fully understand what these hooks in particular were for or what you'd do with them, so it's hard to have an opinion on the matter. What are these hooks used for in practice? Both the names and the event class API should reflect that.
  15. crell uploaded patch set 5 04/28/22, 13:55

  16. Christian Kuhn commented on patch set 5 CR -2 04/28/22, 14:00

    Please don't fiddle with TemplateService and it's hooks at the moment: I'm rewriting the parser and the include logic entirely and will add more suitable events along the way.
  17. Christian Kuhn commented on patch set 5 04/28/22, 14:03

    Reply Unresolved

    see https://review.typo3.org/c/Packages/TYPO3.CMS/+/74285 for progress on this: i'm currently modeling the include strategy as an object tree and i'll break the three hooks inside TemplateService along the way, while adding (at leas one) event that allows manipulation of includes in a general better way.
  18. core-ci voted on patch set 5 V +1 04/28/22, 14:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26599

  19. Christian Kuhn commented on patch set 5 05/22/22, 07:26

    hey. i hope it's ok to abandon this one for now: my ts-parser-rewrite is in still flow and this patch does not help us at the moment since the new implementation will break the hooks anyways.
  20. Christian Kuhn abandoned the change 05/22/22, 07:26