Skip to content

Commit

Permalink
[TASK] Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Hofmann committed Apr 7, 2022
1 parent 57b259e commit 1c61825
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 21 deletions.
40 changes: 29 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 96 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
```

0 comments on commit 1c61825

Please sign in to comment.