72999[!!!][FEATURE] Introduce dedicated class to create typolinks with unified Event
Commit message
Review
-
Code review CR +2 Done
- Oli Bartsch +2
- Stefan Bürk +1
- Oliver Hader +1
-
Verified V +2 Done
- Oli Bartsch +2
- Stefan Bürk +1
- Oliver Hader +1
- core-ci +1 CI
Issues 2
Files 40
- Build/phpstan/phpstan-baseline.neon+1 −16
- typo3/sysext/core/Classes/LinkHandling/LinkService.php+2 −0
- typo3/sysext/core/Documentation/Changelog/12.0/Breaking-96641-TypoLinkRelatedHooksRemoved.rstnew+55 −0
- typo3/sysext/core/Documentation/Changelog/12.0/Deprecation-96641-LinkRelatedFunctionalityInContentObjectRenderer.rstnew+56 −0
- typo3/sysext/core/Documentation/Changelog/12.0/Deprecation-96641-UnusedHookRelatedUrlProcessorInterface.rstnew+44 −0
- typo3/sysext/core/Documentation/Changelog/12.0/Feature-96641-NewPSR-14EventForModifyingLinks.rstnew+70 −0
- typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php+1 −4
- typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php+6 −6
- typo3/sysext/fluid/Classes/ViewHelpers/Link/EmailViewHelper.php3+9 −9
- typo3/sysext/fluid/Classes/ViewHelpers/Link/PageViewHelper.php+1 −1
- typo3/sysext/fluid/Classes/ViewHelpers/Link/TypolinkViewHelper.php+1 −1
- typo3/sysext/fluid/Classes/ViewHelpers/Uri/TypolinkViewHelper.php+1 −1
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/Link/TypolinkViewHelperTest.php+6 −6
- typo3/sysext/form/Classes/Domain/Finishers/RedirectFinisher.php+1 −1
- typo3/sysext/form/Tests/Unit/Domain/Finishers/RedirectFinisherTest.php+1 −4
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php26+112 −352
- typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php+1 −1
- typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php2+1 −1
- typo3/sysext/frontend/Classes/Event/AfterLinkIsGeneratedEvent.php4new+63 −0
- typo3/sysext/frontend/Classes/Http/UrlProcessorInterface.php+1 −0
Show 20 more files
- typo3/sysext/frontend/Classes/Plugin/AbstractPlugin.php+35 −5
- typo3/sysext/frontend/Classes/Typolink/AbstractTypolinkBuilder.php+1 −42
- typo3/sysext/frontend/Classes/Typolink/DatabaseRecordLinkBuilder.php+1 −1
- typo3/sysext/frontend/Classes/Typolink/EmailLinkBuilder.php1+42 −55
- typo3/sysext/frontend/Classes/Typolink/ExternalUrlLinkBuilder.php2+2 −3
- typo3/sysext/frontend/Classes/Typolink/FileOrFolderLinkBuilder.php+1 −3
- typo3/sysext/frontend/Classes/Typolink/HtmlLinkResult.php7new+119 −0
- typo3/sysext/frontend/Classes/Typolink/LegacyLinkBuilder.php+2 −3
- typo3/sysext/frontend/Classes/Typolink/LinkFactory.php5new+313 −0
- typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php+6 −1
- typo3/sysext/frontend/Configuration/Services.yaml+5 −0
- typo3/sysext/frontend/Tests/Functional/SiteHandling/TypoLinkGeneratorTest.php+7 −7
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php+127 −111
- typo3/sysext/frontend/Tests/Unit/Typolink/EmailLinkBuilderTest.phpdeleted+0 −62
- typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php+18 −0
- typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php+6 −0
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php+28 −0
- typo3/sysext/seo/Classes/Canonical/CanonicalGenerator.php4+3 −3
- typo3/sysext/seo/Classes/XmlSitemap/PagesXmlSitemapDataProvider.php+1 −1
- typo3/sysext/seo/Classes/XmlSitemap/RecordsXmlSitemapDataProvider.php+1 −1
Review log 67105
Show 4780 earlier messages
-
Benni Mack uploaded patch set 1 01/12/22, 15:37
-
core-ci voted on patch set 1 V -1 01/12/22, 17:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21979
-
Benni Mack uploaded patch set 2 01/14/22, 10:56
-
core-ci voted on patch set 2 V -1 01/14/22, 12:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22054
-
Benni Mack uploaded patch set 3 01/14/22, 14:37
-
core-ci voted on patch set 3 V -1 01/14/22, 14:57 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22067
-
Benni Mack uploaded patch set 4 01/19/22, 08:07
-
core-ci voted on patch set 4 V -1 01/19/22, 08:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22248
-
Benni Mack uploaded patch set 5 01/19/22, 08:51
-
core-ci voted on patch set 5 V -1 01/19/22, 10:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22249
-
Benni Mack uploaded patch set 6 01/21/22, 20:02
-
core-ci voted on patch set 6 V -1 01/21/22, 22:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22372
-
Benni Mack uploaded patch set 7 01/22/22, 21:40
-
core-ci voted on patch set 7 V -1 01/22/22, 21:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22414
-
Benni Mack uploaded patch set 8 01/24/22, 08:24
-
core-ci voted on patch set 8 V -1 01/24/22, 08:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22443
-
Benni Mack uploaded patch set 9 01/24/22, 10:02
-
core-ci voted on patch set 9 V -1 01/24/22, 10:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22448
-
Benni Mack uploaded patch set 10 01/24/22, 12:20
-
core-ci voted on patch set 10 V -1 01/24/22, 12:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22457
-
Benni Mack uploaded patch set 11 01/24/22, 13:01
-
core-ci voted on patch set 11 V -1 01/24/22, 13:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22460
-
Benni Mack uploaded patch set 12 01/24/22, 15:58
-
core-ci voted on patch set 12 V -1 01/24/22, 16:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22470
-
Benni Mack uploaded patch set 13 01/24/22, 16:17
-
core-ci voted on patch set 13 V +1 01/24/22, 16:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22472
-
Benni Mack updated the commit message in patch set 14 01/25/22, 09:52
-
core-ci voted on patch set 14 V +1 01/25/22, 10:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22509
-
Benni Mack uploaded patch set 15 02/24/22, 18:01
-
Benni Mack uploaded patch set 16 02/24/22, 18:08
-
core-ci voted on patch set 15 V -1 02/24/22, 18:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24213
-
core-ci voted on patch set 16 V -1 02/24/22, 18:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24214
-
Benni Mack uploaded patch set 17 04/17/22, 12:32
-
core-ci voted on patch set 17 V -1 04/17/22, 13:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26105
-
Benni Mack uploaded patch set 18 04/17/22, 19:50
-
core-ci voted on patch set 18 V -1 04/17/22, 20:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26121
-
Oliver Hader uploaded patch set 19 04/19/22, 11:04
-
core-ci voted on patch set 19 V -1 04/19/22, 11:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26182
-
Oliver Hader commented on patch set 19 04/19/22, 11:45
-
Oliver Hader commented on patch set 19 04/19/22, 12:12
I've added lots of comments (just to avoid forgetting them). However, in general I like the idea and direction to add more structure and semantics to link-generation.ContentObjectRenderer.php:1235This would be breaking for e.g. https://github.com/TYPO3-Headless/headless/blob/10b7fcf5782f4a5dbe8ce6f7ddeb830ca9499b2b/Configuration/TypoScript/ContentElement/ContentElementWithHeader.typoscript#L26-L31 → which is fine in general since it allows to be more strict on `typolink` only returning `string` types → however, e.g. for the PWA initiative there should be an intermediate `typolinkResult` (or `buildLink`) stdWrap functionality, which also would be back-ported to TYPO3 v11ContentObjectRenderer.php:4522What about `(array $conf, string = $linkText = '')`?ContentObjectRenderer.php:4530or return `null` since we're still in the `ContentObjectRenderer` scope (for returning complex types, instead of just `string`)LinkBuilder.php:50constructor property promotionLinkBuilder.php:62I'm "struggling" with the dependency on `ContentObjectRenderer` and the implicit dependency on TSFE as well. For a longterm POV this hopefully could be resolved. Maybe it's already possible to process relevant parts (basically `stdWrap`) in `ContentObjectRenderer` and just used those results here in `LinkBuilder`.LinkBuilder.php:299I guess this might become an dedicated service in the `Site` layer of `ext:core`? -
Benni Mack uploaded patch set 20 04/19/22, 20:29
-
Benni Mack uploaded patch set 21 04/19/22, 20:30
-
core-ci voted on patch set 20 V -1 04/19/22, 20:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26202
-
core-ci voted on patch set 21 V -1 04/19/22, 20:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26203
-
Benni Mack uploaded patch set 22 04/19/22, 21:02
-
Benni Mack uploaded patch set 23 04/19/22, 21:07
-
Benni Mack commented on patch set 23 04/19/22, 21:08
LinkBuilder.php:50ReplyDoneLinkBuilder.php:62Replywell, the major problem here is TSFE, so we need to keep this cObj dependency for the time being and can come back to this in v13, I guess.LinkBuilder.php:299ReplyAdded a comment to be handled separately. -
Benni Mack commented on patch set 23 04/19/22, 21:10
ContentObjectRenderer.php:1235Replyyeah, I think we should keep this around for the time being.ContentObjectRenderer.php:4491ReplyreturnLast could be modified via hooks previously so this is superugly and possibly breaking, I think we should start to deprecate returnLast one at a time (returnLast "target" is nonsense IMHO), however for the scope of this patch, we should keep it as is.ContentObjectRenderer.php:4522Replykept the same ordering as in LinkResult->create()ContentObjectRenderer.php:4530Replywhat's the reasoning for this? -
core-ci voted on patch set 23 V -1 04/19/22, 21:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26206
-
core-ci voted on patch set 22 V -1 04/19/22, 21:19 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26205
-
Benni Mack uploaded patch set 24 04/19/22, 21:51
-
core-ci voted on patch set 24 V -1 04/19/22, 21:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26207
-
Benni Mack uploaded patch set 25 04/19/22, 22:08
-
core-ci voted on patch set 25 V -1 04/19/22, 22:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26208
-
Benni Mack uploaded patch set 26 04/20/22, 08:46
-
core-ci voted on patch set 26 V -1 04/20/22, 09:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26222
-
Benni Mack uploaded patch set 27 04/20/22, 09:51
-
core-ci voted on patch set 27 V -1 04/20/22, 09:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26224
-
Benni Mack uploaded patch set 28 04/20/22, 11:32
-
core-ci voted on patch set 28 V -1 04/20/22, 11:41 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26226
-
Benni Mack uploaded patch set 29 04/20/22, 11:46
-
Oliver Klee commented on patch set 29 04/20/22, 11:46
Typo: decicated -> dedicated -
Benni Mack commented on patch set 29 04/20/22, 11:49
ContentObjectRenderer.php:1235ReplyDoneContentObjectRenderer.php:4522ReplyDone -
Benni Mack uploaded patch set 30 04/20/22, 11:52
-
Benni Mack commented on patch set 30 04/20/22, 11:53
Reply
Done -
core-ci voted on patch set 29 V -1 04/20/22, 11:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26227
-
core-ci voted on patch set 30 V -1 04/20/22, 11:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26228
-
Benni Mack uploaded patch set 31 04/20/22, 14:13
-
Oliver Klee wrote 04/20/22, 14:23
Removed cc Oliver Klee. -
core-ci voted on patch set 31 V -1 04/20/22, 14:28 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26233
-
Benni Mack rebased onto patch set 32 04/20/22, 21:23
-
core-ci voted on patch set 32 V -1 04/20/22, 21:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26254
-
Benni Mack uploaded patch set 33 04/20/22, 22:47
-
core-ci voted on patch set 33 V +1 04/20/22, 22:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26255
-
Oli Bartsch commented on patch set 33 04/21/22, 10:41
EmailViewHelper.php:97We do no longer need to set the $linkHref here based on linkResult?ContentObjectRenderer.php:4465Is this comment outdated? There is no link to TSref.ContentObjectRenderer.php:4469Actually returns string|LinkResultInterfaceContentObjectRenderer.php:4493Should be "withLinkText()" (case mismatch)ContentObjectRenderer.php:4549I checked all usages and non does check for the result being NULL. All places just typecast the result to string. Would it make sense to just always return a string? So empty string instead of null.TypoScriptFrontendController.php:1649Missing typecast?AfterLinkIsGeneratedEvent.php:27final classAfterLinkIsGeneratedEvent.php:32Should we use property promotion? public function __construct( private LinkResultInterface $linkResult, private readonly ContentObjectRenderer $contentObjectRenderer ) { }EmailLinkBuilder.php:71Good catch!ExternalUrlLinkBuilder.php:32Isn't the typecast is still necessary, or are we sure $linkDetails['url'] will always be a string?HtmlLinkResult.php:115Is this already escaped?LinkFactory.php:79Default value can be omittedCanonicalGenerator.php:103Missing typecast?CanonicalGenerator.php:126Missing typecast? -
Oliver Hader commented on patch set 33 04/22/22, 07:30
HtmlLinkResult.php:115ReplyNo, but actually it's not know here, e.g. ``` 10 = TEXT 10.value = <span>Link Text</span> 10.typolink.parameter = 123 ``` -
Oliver Hader commented on patch set 33 04/22/22, 08:34
EmailViewHelper.php:97ReplyNope, it was `$frontend->cObj->typoLink($linkText, ['parameter' => $linkHref]);´ before and the `mailto:` in `$linkHref` is now directly submitted to `LinkFactory`ContentObjectRenderer.php:4469ReplyCorrect. I hope we can deprecate the `returnLast` property and promote `createLink` and `createUrl` (and their new `stdWrap` counterparts) -
Oliver Hader commented on patch set 33 04/22/22, 08:47
HtmlLinkResult.php:27I'm not sure yet about this concept and how it's used - my thoughts / 2 cents: * most useful method is `__toString` which makes sure HTML attrs are encoded → other methods of HtmlLinkResult don't seem to be used * HtmlLinkResult is delegating information retrieval to wrapped `$linkResult` * class member `$linkResult` just implements `LinkResultInterface` (as type, not as behavior), thus, there is no guarantee any other specific implementation would have the same behavior for e.g. `withAttributes` and handling it immutable. -
Benni Mack uploaded patch set 34 04/22/22, 11:17
-
Benni Mack commented on patch set 33 04/22/22, 11:17
EmailViewHelper.php:97ReplyDoneContentObjectRenderer.php:4469ReplyYes. I will leave it as is for the time being, because this is / was an issue in v11 already when we implemented "returnLast = result"ContentObjectRenderer.php:4530ReplyDoneExternalUrlLinkBuilder.php:32Replylet's type castHtmlLinkResult.php:115ReplyDoneCanonicalGenerator.php:103ReplyDoneCanonicalGenerator.php:126ReplyDone
-
Benni Mack commented on patch set 34 04/22/22, 11:18
ContentObjectRenderer.php:4465ReplyDoneContentObjectRenderer.php:4493ReplyDoneContentObjectRenderer.php:4549ReplyDoneTypoScriptFrontendController.php:1649ReplyDoneAfterLinkIsGeneratedEvent.php:27ReplyDoneAfterLinkIsGeneratedEvent.php:32ReplyDoneHtmlLinkResult.php:27ReplyIn the end, we should introduce a JsonLinkResult with JsonSerializable and separate the concerns from the main class. -
Benni Mack uploaded patch set 35 04/22/22, 11:22
-
Benni Mack commented on patch set 34 04/22/22, 11:22
LinkFactory.php:79ReplyDone -
core-ci voted on patch set 35 V -1 04/22/22, 11:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26300
-
core-ci voted on patch set 34 V -1 04/22/22, 11:33 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26299
-
Stefan Bürk commented on patch set 35 CR -1 04/22/22, 12:04
on it -
Stefan Bürk uploaded patch set 36 04/22/22, 12:06
-
Benni Mack uploaded patch set 37 04/22/22, 12:09
-
Benni Mack commented on patch set 36 04/22/22, 12:09
Reply
sorry. -
Stefan Bürk commented on patch set 37 04/22/22, 12:16
Reply
rerun phpstan generate baseline than yourself on your next push ;) (that was what I had pushed) -
core-ci voted on patch set 36 V +1 04/22/22, 12:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26302
-
core-ci voted on patch set 37 V +1 04/22/22, 12:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26303
-
Oliver Hader commented on patch set 37 04/22/22, 12:59
HtmlLinkResult.php:27Shall we mark this @internal until JsonLinkResult (and what else) are in place? -
Oliver Hader commented on patch set 37 V +1 04/22/22, 13:14
LinkFactory.php:89typolink.userFunc is pretty similar to the new AfterLinkIsGeneratedEvent - or could be substituted with it. Since the hook is dropped already, maybe it's time to drop this userFunc as well? -
Stefan Bürk commented on patch set 37 04/22/22, 13:28
ContentObjectRenderer.php:4575Should be typoLink() - or not ?ContentObjectRenderer.php:4604Should be typoLink() - or not ?ContentObjectRenderer.php:4650Should we not call here $this->createUrl() directly ? As typoLink_URL() is stripped down to it anyway ? Nit-picking, but avoid one superflous function nesting level. -
Stefan Bürk voted on patch set 37 V +1 04/22/22, 13:30
-
Oli Bartsch commented on patch set 37 CR -1 04/22/22, 13:52
On it -
Oli Bartsch uploaded patch set 38 04/22/22, 16:22
-
Oli Bartsch commented on patch set 38 04/22/22, 16:27
ContentObjectRenderer.php:4575ReplyDoneContentObjectRenderer.php:4604ReplyDoneContentObjectRenderer.php:4650ReplyDoneHtmlLinkResult.php:27ReplyDoneLinkFactory.php:89ReplyFine for you, if we evaluate this in a separate patch? -
core-ci voted on patch set 38 V +1 04/22/22, 16:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/26310
-
Oliver Hader commented on patch set 38 V +1 CR +1 04/22/22, 16:33
LinkFactory.php:89ReplySure, it's fine... no need to re-iterate this change more and more -
Stefan Bürk commented on patch set 38 V +1 CR +1 04/22/22, 16:35
Thanks for taking care of the comments, Oliver. -
Oli Bartsch voted on patch set 38 V +1 CR +1 04/22/22, 16:46
-
Oli Bartsch voted on patch set 38 V +2 CR +2 04/22/22, 16:52
-
Oli Bartsch merged patch set 39 04/22/22, 16:52
ContentObjectRenderer.php:4491