47094[FEATURE] Add LinkService and "t3://" linking syntax
Commit message
Review
-
Code review CR +2
- Andreas Kienast +2
- Georg Ringer +1
- Frank Nägler +1
-
Verified V +2
- Andreas Kienast +2
- Frank Nägler +1
- TYPO3com +1 CI
Issues 1
Files 33
- typo3/sysext/backend/Classes/Controller/LinkBrowserController.php+9 −0
- typo3/sysext/backend/Classes/Tree/View/ElementBrowserPageTreeView.php+3 −1
- typo3/sysext/backend/Resources/Public/JavaScript/FormEngineLinkBrowserAdapter.js+0 −16
- typo3/sysext/core/Classes/LinkHandling/EmailLinkHandler.phpnew+46 −0
- typo3/sysext/core/Classes/LinkHandling/FileLinkHandler.php1new+92 −0
- typo3/sysext/core/Classes/LinkHandling/FolderLinkHandler.php1new+79 −0
- typo3/sysext/core/Classes/LinkHandling/LegacyLinkNotationConverter.phpnew+218 −0
- typo3/sysext/core/Classes/LinkHandling/LinkHandlingInterface.phpnew+52 −0
- typo3/sysext/core/Classes/LinkHandling/LinkService.php2new+148 −0
- typo3/sysext/core/Classes/LinkHandling/PageLinkHandler.phpnew+88 −0
- typo3/sysext/core/Classes/LinkHandling/UrlLinkHandler.php1new+61 −0
- typo3/sysext/core/Configuration/DefaultConfiguration.php+7 −0
- typo3/sysext/core/Documentation/Changelog/master/Feature-74365-LinkServiceForUnifiedReferencingSyntax.rst1new+128 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/EmailLinkHandlerTest.php2new+80 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/FileLinkHandlerTest.php4new+123 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/FolderLinkHandlerTest.php2new+127 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/LegacyLinkNotationConverterTest.php3new+281 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/LinkServiceTest.php1new+242 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/PageLinkHandlerTest.php2new+140 −0
- typo3/sysext/core/Tests/Unit/LinkHandling/UrlLinkHandlerTest.php1new+125 −0
Show 13 more files
- typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php3+94 −130
- typo3/sysext/frontend/Tests/Unit/ContentObject/ContentObjectRendererTest.php1+0 −59
- typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php+25 −27
- typo3/sysext/recordlist/Classes/LinkHandler/FolderLinkHandler.php+17 −1
- typo3/sysext/recordlist/Classes/LinkHandler/MailLinkHandler.php+3 −3
- typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php1+25 −24
- typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php+2 −2
- typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/File.html+1 −1
- typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/Folder.html+1 −1
- typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/Page.html+1 −1
- typo3/sysext/recordlist/Resources/Public/JavaScript/FileLinkHandler.js+1 −4
- typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js+3 −8
- typo3/sysext/rtehtmlarea/Classes/Controller/BrowseLinksController.php+9 −27
Review log 4956
Show 31 earlier messages
-
Benni Mack uploaded patch set 1 03/05/16, 12:46
-
Benni Mack uploaded patch set 2 03/05/16, 13:36
-
Benni Mack uploaded patch set 3 03/05/16, 18:07
-
Benni Mack uploaded patch set 4 03/05/16, 18:16
-
Benni Mack uploaded patch set 5 03/05/16, 18:49
-
Mathias Schreiber uploaded patch set 6 03/05/16, 21:52
-
Benni Mack uploaded patch set 7 03/05/16, 22:40
-
Mathias Schreiber uploaded patch set 8 03/06/16, 11:19
-
Benni Mack wrote 03/06/16, 12:01
Patch set 9: Commit message was updated. -
Benni Mack wrote 03/06/16, 12:49
Patch set 10: Commit message was updated. -
Andreas Wolf commented on patch set 10 CR +1 V +1 03/06/16, 17:33
ContentObjectRenderer.php:5870probably add a comment here that the fragment was named section historically -
Frank Nägler commented on patch set 10 03/07/16, 08:24
how to handle custom link types, e.g. links to news or custom records? -
Frank Nägler commented on patch set 10 03/07/16, 11:14
ok, will rephrase my question: What is the plan to handle custom links e.g. news? When will this be possible with the new syntax? -
Christian Kuhn commented on patch set 10 03/07/16, 20:37
this needs thoughts. i'll try to put my head into this a bit over the next days and will contact benni with some details. one question that comes up in my head already is if we could maybe document the new syntax in a formal grammar like bnf. this could be very helpful to specify the blows and whistles and to validate and parse this stuff. -
Markus Klein commented on patch set 10 03/07/16, 20:42
+1 lolli for a BNF. Not only for this, but maybe also for linkhandlers in general. Including the linkhandler ext into Core is still on my todo since one year or so. -
Helmut Hummel commented on patch set 10 CR -1 03/08/16, 08:32
The proposed syntax is URN like[1], which is pretty smart and neat. URNs in its pure form have a BNF already: <URN> ::= "urn:" <NID> ":" <NSS> However the proposed syntax does not really follow this BNF, but as it does not start with "urn:" but with "t3:". So, a correct URN would rather be: urn:x-t3:<NSS>, where <NSS> woud be the "Resource identifier" prefixed by the "Resource handler key". There are however a few things to consider when going this path: 1. URNs have been deprecated in favor of URIs[1] to identifiy and/or locate resources 2. The NSS proposed here (for referencing pages), is self made, arbitrary, non uniform, somewhat difficult to parse and unflexible. Therefore I propose a URI syntax rather than a URN syntax to represent resources of a TYPO3 installation like that: "typolink://page?id=12&type=0&foo=bar#fragment" This URI can be parsed with parse_url() in one step, the scheme representing the "syntax namespace" (be it "t3" or "typolink" does not really matter here), the host representing the "resource handler key" and the query representing the "resource identifier" The resource identifier in such a form, can be parsed in one step as well using parse_str(). Instead of having a custom, unflexible hard to parse syntax (<id/alias>,<type>?<additionalQueryString>#fragment), we have straightforward, standard, extensible and uniform way to identifiy a resource. The handler of the type "page" can get this parsed array and iterate over the found keys pretty easily. Summary: With the proposed URI syntax, we get a bnf for free[2], have a flexible and extensible syntax that is really robust and future proof. Side note: This syntax (neither the one proposed in the patch, nor the one proposed by me) does not replace the typolink parameter syntax completely yet, as the latter allows to specify some tag values as well (target, title, class…). The complete typolink syntax should be replaced with a proper XML tag (prefereably <a> tag) where the href attribute contains the URI to the resource and other attributes can be added at will (or by configuration). [1]https://en.wikipedia.org/wiki/Uniform_Resource_Name [2]https://www.w3.org/Addressing/URL/5_URI_BNF.html -
Helmut Hummel commented on patch set 10 03/08/16, 09:36
looking at https://docs.google.com/document/d/10EgY5VUxF-vo46XDFqp6JjjsUr4cxZX7ykNHVgQj37s/edit?pref=2&pli=1, there might be even more to consider. My proposed syntax could however handle that as well: "typolink://record?table=pages&id=12&type=0&foo=bar#fragment" But we could also include the path and make the host name and path be the combined resource handler identifier: "typolink://record/pages?id=12&type=0&foo=bar#fragment" $resourceHandlerIdentifier = $parsedUri['host'] . ($parsedUri['path'] ?? '') both are valid. choose at your own liking -
Helmut Hummel commented on patch set 10 03/08/16, 10:43
I also have architectural remarks as well. The "LinkService" class does way too much. It does: 1. Converts legacy notations to new resource representation (array) 2. Converts UR(N/I) notation to resource representation checking for hard coded handlers 3. Implements resource handling functionality for different (hard coded) resources Downsides are: tight coupling (see number of imports), fat class with indistinct functionality, impossible to extend (closed for extension) These are 3 architectural no nos, which can easily be resolved by having dedicated classes for the following functionality: 1. Conversion from legacy resource notation to new resource notation should be a dedicated class (LegacyLinkNotationConverter) 2. Resolve resource handler from URI (ResourceHandlerResolver): 3. Resource handler classes. 3a) They should be regitered somehow (registriation can be skipped in the first run) 3b) Each resource handler is reposnsible for a single resource handler indentifier (I think we won't need a stack of handler for one identifier with priorities in the first run, but may be worth considering. Hm, maybe replace that with current URL processors) 3c) Each resoruce handler should implement an interface defining that they: 1. retrieve a public URL for the resource (not sure what else is needed) -
Helmut Hummel wrote 03/08/16, 10:54
Removed the following votes: * Code-Review-1 by Helmut Hummel <helmut.hummel@typo3.org> -
Benni Mack commented on patch set 10 CR -2 03/08/16, 17:03
will tackle this one with the remarks added. -
Frank Nägler commented on patch set 10 04/01/16, 15:16
nice idea, here are some ideas for possible use cases (only ideas, please not discuss now if this are useful ideas ;), maybe this helps finding the "correct" syntax: ## Links in Frontend # Link to page: t3://page?id=12&type=0&foo=bar#fragment # Link to a FAL record (file or folder) t3://fal?id=1 # Link to a FAL file record t3://fal?id=1&type=file # Link to a FAL folder record t3://fal?id=1&type=folder # Link to any kind of record t3://record?table=tx_news_domain_model_news&id=1 t3://record?config=news&id=1 # Link to an email (maybe mailto: !?) t3://mail?to=foo@bar.baz&subject=foo # Link to external sources http://www.google.com https://www.google.com ## Links in Backend # Link to preview a page t3://preview?id=1 t3://preview?id=1&feuser=123 # Link to BE module t3://backend?route=/main # Link to controller/action t3://backend?controller=Foo&action=bar # Link to help t3://help?table=_MOD_web_layout&field=language_list # Search Link t3://search?term=foo # Cache Links t3://cache?clear=[all|page]&id=1 -
Markus Klein commented on patch set 10 04/01/16, 18:24
I'm +1 for URIs and XML compliant handling of the additional attributes. header_link for instance should hold a real <a href="t3://page..." class="ole" /> tag then. -
Jozef Spisiak uploaded patch set 11 04/14/16, 12:46
-
Christian Kuhn commented on patch set 11 04/14/16, 12:47
still wip, pushed by josef to show an intermediate state. -
Jozef Spisiak uploaded patch set 12 04/15/16, 18:53
-
Jozef Spisiak commented on patch set 12 04/15/16, 18:57
Still wip, I think I implemented now Helmuts comments in regard to the code. I will now continue with the migration wizard. Please check if I placed the new files in correct folders and if they are named properly. -
Christian Kuhn commented on patch set 12 04/15/16, 19:05
ContentObjectRendererTest.php:119this is a bit smelly (but imho no blocker for now): it means there is some incomplete mocking in tests that fail if those lines are not added. -
Benni Mack uploaded patch set 13 05/19/16, 21:29
-
Benni Mack uploaded patch set 14 05/19/16, 21:31
-
Benni Mack commented on patch set 14 05/19/16, 21:32
IMHO the rest of the job here is: - move LinkService to LinkHandling folder - add comments to all methods - use [] syntax instead of mixed array() and [] in new code - re-check and re-read tests - re-check and re-read code - re-check RST file - test the stuff in real life -
Benni Mack uploaded patch set 15 05/20/16, 21:21
-
Benni Mack voted on patch set 14 CR 0 05/20/16, 21:25
-
Benni Mack voted on patch set 15 CR 0 05/20/16, 21:25
-
Georg Ringer voted on patch set 15 V +1 05/24/16, 21:38
-
Wouter Wolters commented on patch set 15 CR -1 06/10/16, 15:08
did a complete review now.FileLinkHandler.php:20files not foldersFolderLinkHandler.php:34whitespace hereLinkService.php:94@throws missingLinkService.php:140@throws missingUrlLinkHandler.php:27stringEmailLinkHandlerTest.php:19missing phpdocEmailLinkHandlerTest.php:63assertSameFileLinkHandlerTest.php:23phpdoc missingFileLinkHandlerTest.php:27filesFileLinkHandlerTest.php:86assertSameFileLinkHandlerTest.php:113assertSameFolderLinkHandlerTest.php:22phpdoc missingFolderLinkHandlerTest.php:36foldersLegacyLinkNotationConverterTest.php:25phpdoc missingLegacyLinkNotationConverterTest.php:205strpos === 0LegacyLinkNotationConverterTest.php:249strpos === 0LinkServiceTest.php:19phpdoc missingPageLinkHandlerTest.php:19phpdoc missingPageLinkHandlerTest.php:32spaces, also belowUrlLinkHandlerTest.php:19phpdoc missingContentObjectRenderer.php:6113htmlspecialcharsContentObjectRenderer.php:6131htmlspecialchars -
Wouter Wolters commented on patch set 15 06/10/16, 15:18
Missed my general remarks/questions I don't see any type hinting, can we add this? PHP7 strict declaration should be implemented here as well IMO -
Benni Mack uploaded patch set 16 06/27/16, 05:32
-
TYPO3com voted on patch set 16 V -1 06/27/16, 05:35 Completed build in 02m 57s on Mon, 27 Jun, 07:35 AM Test Summary: 9708 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-259
-
Benni Mack uploaded patch set 17 07/11/16, 14:09
-
TYPO3com voted on patch set 17 V -1 07/11/16, 14:13 Completed build in 03m 29s on Mon, 11 Jul, 04:13 PM Test Summary: 8 of 18636 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-752
-
Jozef Spisiak uploaded patch set 18 07/11/16, 15:28
-
TYPO3com voted on patch set 18 V -1 07/11/16, 15:35 Completed build in 07m 28s on Mon, 11 Jul, 05:35 PM Test Summary: 18636 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-766
-
Benni Mack uploaded patch set 19 07/12/16, 10:02
-
TYPO3com voted on patch set 19 V +1 07/12/16, 10:24 Completed build in 21m 59s on Tue, 12 Jul, 12:24 PM Test Summary: 18644 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-830
-
Markus Klein uploaded patch set 20 07/19/16, 17:52
-
TYPO3com voted on patch set 20 V +1 07/19/16, 17:57 Completed build in 05m 14s on Tue, 19 Jul, 07:57 PM Test Summary: 19506 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1136
-
Benni Mack uploaded patch set 21 07/20/16, 21:16
-
TYPO3com voted on patch set 21 V +1 07/20/16, 21:21 Completed build in 04m 59s on Wed, 20 Jul, 11:21 PM Test Summary: 19514 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1210
-
Frank Nägler commented on patch set 21 CR -1 08/07/16, 11:12
temporary -1 please check my commentPageLinkHandler.php:224imho empty check is needed here, right? -
Frank Nägler uploaded patch set 22 08/07/16, 13:48
-
Frank Nägler voted on patch set 22 CR +1 V +1 08/07/16, 13:48
-
TYPO3com voted on patch set 22 V +1 08/07/16, 13:50 Completed build in 02m 27s on Sun, 7 Aug, 03:50 PM Test Summary: 18668 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-1897
-
Georg Ringer voted on patch set 22 CR +1 08/09/16, 11:07
-
Andreas Kienast voted on patch set 22 CR +2 V +2 08/10/16, 07:09
-
Gerrit merged patch set 22 08/10/16, 07:09
-
Frans Saris commented on patch set 23 08/10/16, 10:36
Feature-74365-LinkServiceForUnifiedReferencingSyntax.rst:86should be **string**