Skip to content

Commit

Permalink
[BUGFIX] Make route-enhancer configuration work (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Feb 12, 2019
1 parent cece9ee commit ef73abd
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 83 deletions.
72 changes: 72 additions & 0 deletions Configuration/Routes/BlogArchive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
routeEnhancers:
BlogArchive:
type: Extbase
extension: Blog
plugin: Archive
routes:
-
routePath: '/{year}'
_controller: 'Post::listPostsByDate'
_arguments:
year: year
-
routePath: '/{year}/{month}'
_controller: 'Post::listPostsByDate'
_arguments:
year: year
month: month
defaultController: 'Post::listPostsByDate'
defaults:
year: ''
month: ''
aspects:
year:
type: StaticRangeMapper
start: '1950'
end: '2050'
month:
type: StaticValueMapper
map:
january: 1
february: 2
march: 3
april: 4
may: 5
june: 6
july: 7
august: 8
september: 9
october: 10
november: 11
december: 12
localeMap:
-
locale: 'de_.*'
map:
januar: 1
februar: 2
maerz: 3
april: 4
mai: 5
juni: 6
juli: 7
august: 8
september: 9
oktober: 10
november: 11
dezember: 12
-
locale: 'fr_.*'
map:
janvier: 1
fevrier: 2
mars: 3
avril: 4
mai: 5
juin: 6
juillet: 7
aout: 8
septembre: 9
octobre: 10
novembre: 11
decembre: 12
21 changes: 21 additions & 0 deletions Configuration/Routes/BlogAuthorPosts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
routeEnhancers:
AuthorPosts:
type: Extbase
extension: Blog
plugin: AuthorPosts
routes:
-
routePath: '/{author_title}'
_controller: 'Post::listPostsByAuthor'
_arguments:
author_title: author
defaultController: 'Post::listPostsByAuthor'
requirements:
author_title: '^[a-z0-9].*$'
aspects:
author_title:
type: PersistedPatternMapper
tableName: 'tx_blog_domain_model_author'
routeFieldPattern: '^(?P<slug>.+)$'
routeFieldName: 'slug'
routeFieldResult: '{slug}'
19 changes: 19 additions & 0 deletions Configuration/Routes/BlogCategory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
routeEnhancers:
BlogCategory:
type: Extbase
extension: Blog
plugin: Category
routes:
-
routePath: '/{category_title}'
_controller: 'Post::listPostsByCategory'
_arguments:
category_title: category
defaultController: 'Post::listPostsByCategory'
aspects:
category_title:
type: PersistedPatternMapper
tableName: sys_category
routeFieldPattern: '^(?P<slug>.+)$'
routeFieldName: 'slug'
routeFieldResult: '{slug}'
10 changes: 10 additions & 0 deletions Configuration/Routes/BlogFeedWidget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
routeEnhancers:
PageTypeSuffix:
type: PageType
map:
'blog.recent.xml': 200
'blog.category.xml': 210
'blog.tag.xml': 220
'blog.archive.xml': 230
'blog.comments.xml': 240
'blog.author.xml': 250
19 changes: 19 additions & 0 deletions Configuration/Routes/BlogTag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
routeEnhancers:
BlogTag:
type: Extbase
extension: Blog
plugin: Tag
routes:
-
routePath: '/{tag_title}'
_controller: 'Post::listPostsByTag'
_arguments:
tag_title: tag
defaultController: 'Post::listPostsByTag'
aspects:
tag_title:
type: PersistedPatternMapper
tableName: tx_blog_domain_model_tag
routeFieldPattern: '^(?P<slug>.+)$'
routeFieldName: 'slug'
routeFieldResult: '{slug}'
89 changes: 6 additions & 83 deletions Configuration/Routes/Default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,9 @@
# But you can simply include it in your site configuration:
# imports:
# - { resource: "EXT:blog/Configuration/Routes/Default.yaml" }
routeEnhancers:
BlogCategoryPlugin:
type: Extbase
extension: Blog
plugin: Category
routes:
- { routePath: '/{category_title}', _controller: 'Post::listPostsByCategory', _arguments: {'category_title': 'category'} }
defaultController: 'Post::listRecentPostsAction'
aspects:
category_title:
type: PersistedPatternMapper
tableName: 'sys_category'
routeFieldPattern: '^(?P<title>.+)-(?P<uid>\d+)$'
routeFieldResult: '{title}-{uid}'
BlogTagPlugin:
type: Extbase
extension: Blog
plugin: Tag
routes:
- { routePath: '/{tag_name}', _controller: 'Post::listPostsByTag', _arguments: {'tag_name': 'tag'} }
defaultController: 'Post::listRecentPostsAction'
aspects:
tag_name:
type: PersistedPatternMapper
tableName: 'tx_blog_domain_model_tag'
routeFieldPattern: '^(?P<title>.+)-(?P<uid>\d+)$'
routeFieldResult: '{title}-{uid}'
BlogAuthorPlugin:
type: Extbase
extension: Blog
plugin: AuthorPosts
routes:
- { routePath: '/{author_name}', _controller: 'Post::listPostsByAuthor', _arguments: {'author_name': 'author'} }
defaultController: 'Post::listRecentPostsAction'
aspects:
author_name:
type: PersistedPatternMapper
tableName: 'tx_blog_domain_model_author'
routeFieldPattern: '^(?P<name>.+)$'
routeFieldResult: '{name}'
BlogArchivePlugin:
type: Extbase
extension: Blog
plugin: Archive
routes:
- { routePath: '/{year}', _controller: 'Post::listPostsByDate', _arguments: {'year': 'year'} }
- { routePath: '/{year}/{month}', _controller: 'Post::listPostsByDate', _arguments: {'year': 'year', 'month': 'month'} }
defaultController: 'Post::listRecentPostsAction'
defaults:
month: null
requirements:
year: '[0-9]{4}'
aspects:
month:
type: StaticValueMapper
map:
january: 1
february: 2
march: 3
april: 4
may: 5
june: 6
july: 7
august: 8
september: 9
october: 10
november: 11
december: 12
localeMap:
- locale: 'de_.*'
map:
januar: 1
februar: 2
maerz: 3
april: 4
mai: 5
juni: 6
juli: 7
august: 8
september: 9
oktober: 10
november: 11
dezember: 12
imports:
- { resource: "EXT:blog/Configuration/Routes/BlogCategory.yaml" }
- { resource: "EXT:blog/Configuration/Routes/BlogTag.yaml" }
- { resource: "EXT:blog/Configuration/Routes/BlogArchive.yaml" }
- { resource: "EXT:blog/Configuration/Routes/BlogAuthorPosts.yaml" }
- { resource: "EXT:blog/Configuration/Routes/BlogFeedWidget.yaml" }

0 comments on commit ef73abd

Please sign in to comment.