[FEATURE] Add new redirect `PageTypeSource` source type implementation
It's possible that project instances are configured to use RouteEnhancers and RouteDecorators, e.g. PageTypeSuffix RouteDecorater with a suffix for page type "0" (zero) like ".html". Until now, only the slug-field value has been used as source path for auto created redirects, which neglected to respect these route configuration possibilities. That means that a proper redirect hasn't been create if for e.g. the ".html" suffix has been configured for page type "0". Since #99188 introduced the "SlugRedirectChangeItemCreatedEvent" it's possible to add further source types, for which redirects are created. This change provides the "PageTypeSource" as new generic source type for page type based sources. The TYPO3 core adds a listener to build an URI with page type "0" and adds this to the current change item as source. This added `PageTypeSource` will replace the `PlainSlugReplacementSource` if the source host and path are the same - it overrules it to avoid duplicate redirects. That means, if both are providing different source information both are kept and two different redirects are created. Extension authors can now use the new PageTypeSource type to provide additional sources for other page types registering a custom "SlugRedirectChangeItemCreatedEvent" listener - or remove the "PlainSlugReplacementSource" if needed. With this event based solution configuration options are kept simple. Resolves: #94499 Related: #99746 Releases: main Change-Id: Ic4feb8de1b05ba9d06dce2acaa0537ab39245e92 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77195 Tested-by:core-ci <typo3@b13.com> Reviewed-by:
Stefan Froemken <froemken@gmail.com> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by:
Stefan Froemken <froemken@gmail.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Stefan Bürk <stefan@buerk.tech>
Showing
- typo3/sysext/core/Documentation/Changelog/12.3/Feature-94499-ImplementAddPageTypeZeroSourceEventListener.rst 136 additions, 0 deletions...ure-94499-ImplementAddPageTypeZeroSourceEventListener.rst
- typo3/sysext/core/Documentation/Changelog/12.3/Feature-94499-ProvideAdditionalPageTypeSourceAuto-createRedirectSourceType.rst 191 additions, 0 deletions...AdditionalPageTypeSourceAuto-createRedirectSourceType.rst
- typo3/sysext/redirects/Classes/EventListener/AddPageTypeZeroSource.php 104 additions, 0 deletions...redirects/Classes/EventListener/AddPageTypeZeroSource.php
- typo3/sysext/redirects/Classes/RedirectUpdate/PageTypeSource.php 49 additions, 0 deletions...ysext/redirects/Classes/RedirectUpdate/PageTypeSource.php
- typo3/sysext/redirects/Configuration/Services.yaml 6 additions, 0 deletionstypo3/sysext/redirects/Configuration/Services.yaml
- typo3/sysext/redirects/Tests/Functional/EventListener/AddPageTypeZeroSourceTest.php 261 additions, 0 deletions...ts/Functional/EventListener/AddPageTypeZeroSourceTest.php
- typo3/sysext/redirects/Tests/Functional/EventListener/AddPlainSlugReplacementSourceTest.php 18 additions, 8 deletions...ional/EventListener/AddPlainSlugReplacementSourceTest.php
- typo3/sysext/redirects/Tests/Functional/EventListener/Fixtures/SimpleSiteRootWithPage.csv 4 additions, 0 deletions...ctional/EventListener/Fixtures/SimpleSiteRootWithPage.csv
Please register or sign in to comment