[FEATURE] Introduce RouteEnhancers for Page-based Routing 84/58384/72
authorBenni Mack <benni@typo3.org>
Wed, 26 Sep 2018 22:46:43 +0000 (00:46 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Sat, 29 Sep 2018 15:00:21 +0000 (17:00 +0200)
commit4844fae6dbf99c2c860bb18b73342f50b73dff6d
treebddaa51445c65f20bb729d7311b178550bf47fa4
parent8c225c61eab1ddf1c7aab3e735641a8f148b0314
[FEATURE] Introduce RouteEnhancers for Page-based Routing

Page-based routing can now be configured within a site
configuration to add so-called "route enhancers" which
allow to add more placeholders to a route for a page.

There are three Enhancers that TYPO3 now ships with:
- SimpleEnhancer
- PluginEnhancer
- ExtbasePluginEnhancer

It is also possible to add custom enhancers by third-
party extensions.

Each placeholder within an enhancer can receive a
so-called "Aspect", usually used for mapping speaking
values instead of IDs, or month-names in an archive
link, and "modifiers" to modify a placeholder.

The simple enhancer transfers a link parameter,
previously maybe used to add a `&product=123`,
which will now result into `/product/123` for a
page. PluginEnhancer adds a namespace, common
for simple plugins or Pi-Based plugins, and
the ExtbasePluginEnhancer adds logic for multiple
route variants to be added, depending on the
controller/action combinations.

Aspects are processors / modifiers / mappers to
transfer a placeholder value back & forth to
make each placeholder value more "speaking".

TYPO3 Core ships with the following aspects:
* LocaleModifier (for localized path segments)
* StaticValueMapper (for path segments with a static list)
* StaticRangeMapper (for pagination)
* PersistedAliasMapper (for slug fields)
* PersistedPatternMapper (for database records without slug fields)

Routing now returns a so-called "PageArguments" object
which is then used for evaluating site-based URL
handling and the cHash calculation.

It is highly discouraged to access _GET or _POST
variables within any kind of code now, instead
the PSR-7 request object should be used as much
as possible.

Releases: master
Resolves: #86365
Change-Id: I77e001a5790f1ab3bce75695ef0e1615411e2bd9
Reviewed-on: https://review.typo3.org/58384
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
37 files changed:
typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/AspectInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/DelegateInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/LocaleModifier.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/MappableAspectInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/MappableProcessor.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/ModifiableAspectInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/PersistedAliasMapper.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/PersistedPatternMapper.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/PersistenceDelegate.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/StaticMappableAspectInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/StaticRangeMapper.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Aspect/StaticValueMapper.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/AbstractEnhancer.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/EnhancerFactory.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/EnhancerInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/PluginEnhancer.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/ResultingInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/SimpleEnhancer.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Enhancer/VariableProcessor.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/PageArguments.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/PageRouter.php
typo3/sysext/core/Classes/Routing/PageUriMatcher.php [new file with mode: 0644]
typo3/sysext/core/Classes/Routing/Route.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Documentation/Changelog/master/Feature-86365-RoutingEnhancersAndAspects.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Routing/Enhancer/VariableProcessorTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Routing/PageRouterTest.php
typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php
typo3/sysext/extbase/Classes/Routing/ExtbasePluginEnhancer.php [new file with mode: 0644]
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Middleware/PageArgumentValidator.php
typo3/sysext/frontend/Classes/Middleware/PageResolver.php
typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugLinkGeneratorTest.php
typo3/sysext/frontend/Tests/Unit/Middleware/PageResolverTest.php
typo3/sysext/seo/Tests/Functional/XmlSitemap/XmlSitemapIndexTest.php