calien / persisted-sanitized-routing
Persisted Sanitized Pattern Routing for TYPO3
Installs: 2 258
Dependents: 0
Suggesters: 1
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 2
Type:typo3-cms-extension
Requires
- php: >=7.2
- typo3/cms-core: ^9.5 | ^10.4 | ^11.5
README
#Persisted sanitized pattern mapping
What does it do?
Enables the possibility generating sanitized URL parts from persisted patterns. The default PersistedPatternAspect takes e.g. database values and uses them "as they are", including umlauts, special characters and spaces, which will return them into your url and result in unexpected behaviours.
This PersistedSanitizedRoutingAspect encodes and decodes the database part and will make better readable URL parts.
How does it work?
Adds a new routing aspect extending the PersistedPatternMapper from TYPO3 core with sanitized URL parts.
aspects: country: type: PersistedSanitizedPatternMapper tableName: static_countries routeFieldPattern: '^(.*)-(?P<uid>\d+)$' routeFieldResult: '{cn_short_de|sanitized}-{uid}' localeMap: - locale: 'de_*' field: cn_short_de - locale: 'en_*' field: cn_short_en territory: type: PersistedSanitizedPatternMapper tableName: static_territories routeFieldPattern: '^(.*)-(?P<uid>\d+)$' routeFieldResult: '{tr_name_de|sanitized}-{uid}' localeMap: - locale: 'de_*' field: tr_name_de - locale: 'en_*' field: tr_name_en
As you can see, localization is respected, if needed.
Installation
Only install the extension and configure your persisted pattern mappers as described above fitting your needs. The |sanitized part will respect the field you want to sanitize.