diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 14284f1..b624c81 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,17 +5,8 @@ - - - - - - - - - - + + @@ -142,8 +139,24 @@ @@ -160,4 +173,9 @@ + + + + \ No newline at end of file diff --git a/README.md b/README.md index 61c8a10..e20bc42 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,46 @@ -#Persisted sanitized pattern mapping +#Extended Routing Aspects ## 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. +Adds some more Mappers for Routing Aspects feature in TYPO3. -This PersistedSanitizedRoutingAspect encodes and decodes the database part and -will make better readable URL parts. ## How does it work? +With four new Routing aspects you can handle more possibilities for advanced routing in TYPO3. + +## The mappers + +### DateTimeMapper + +Allows you to create customized url parts including localization to get DateTime values inspeaking parts +without using a dataset with defined slug. + +```yaml +Archive: + type: Extbase + extension: News + plugin: Archive + routes: + - routePath: '/{day}' + _controller: 'Archive::list' + _arguments: + day: day + defaultController: 'Archive::list' + aspects: + day: + type: DateTimeMapper + format: Y-m-d + localeFormat: + - + locale: 'de_.*' + format: d-m-Y +``` + +### PersistedSanitizedPatternMapper + Adds a new routing aspect extending the PersistedPatternMapper from TYPO3 core with sanitized URL parts. +Localization is respected, if needed. ```yaml aspects: @@ -38,9 +66,67 @@ aspects: field: tr_name_en ``` -As you can see, localization is respected, if needed. +### PersistedDisabledAliasMapper + +Allows creating full URLs for disabled elements by TCA enablecolumns. Helpful, if you have to create the URLs +before publishing the record. +Usage as the default PersistedAliaMapper. + +```yaml +News: + type: Extbase + extension: News + plugin: news + routes: + - + routePath: '/{title}' + _controller: 'News::single' + _arguments: + title: news + aspects: + title: + type: PersistedDisabledliasMapper + tableName: tx_news_domain_model_news + routeFieldName: path_segment +``` + +### PersistedNullableAliasMapper + +Allows a default value for normally aliased URL path segment. For example, a news without category, but +URL part is defined with category. + +```yaml +News: + type: Extbase + extension: News + plugin: News + routes: + - + routePath: '/{category}/{title}' + _controller: 'News::single' + _arguments: + category: category + title: news + aspects: + category: + type: PersistedNullableAliasMapper + default: 'no-category' + tableName: tx_news_domain_model_category + routeFieldName: path_segment + title: + type: PersistedAliasMapper + tableName: tx_news_domain_model_news + routeFieldName: path_segment +``` ## 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. +Possible via extensions.typo3.org, ZIP upload or composer. + +### Extension Repository +[a link]https://extensions.typo3.org/extension/extended_routing + +### Composer +```shell +composer require calien/extended-routing +``` \ No newline at end of file