From ef73abdbc6420290eb62f3d71c5049ceb5d660dc Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Tue, 12 Feb 2019 21:02:25 +0100 Subject: [PATCH] [BUGFIX] Make route-enhancer configuration work (#29) --- Configuration/Routes/BlogArchive.yaml | 72 ++++++++++++++++++ Configuration/Routes/BlogAuthorPosts.yaml | 21 ++++++ Configuration/Routes/BlogCategory.yaml | 19 +++++ Configuration/Routes/BlogFeedWidget.yaml | 10 +++ Configuration/Routes/BlogTag.yaml | 19 +++++ Configuration/Routes/Default.yaml | 89 ++--------------------- 6 files changed, 147 insertions(+), 83 deletions(-) create mode 100644 Configuration/Routes/BlogArchive.yaml create mode 100644 Configuration/Routes/BlogAuthorPosts.yaml create mode 100644 Configuration/Routes/BlogCategory.yaml create mode 100644 Configuration/Routes/BlogFeedWidget.yaml create mode 100644 Configuration/Routes/BlogTag.yaml diff --git a/Configuration/Routes/BlogArchive.yaml b/Configuration/Routes/BlogArchive.yaml new file mode 100644 index 00000000..d80f82cb --- /dev/null +++ b/Configuration/Routes/BlogArchive.yaml @@ -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 diff --git a/Configuration/Routes/BlogAuthorPosts.yaml b/Configuration/Routes/BlogAuthorPosts.yaml new file mode 100644 index 00000000..fc8a9a96 --- /dev/null +++ b/Configuration/Routes/BlogAuthorPosts.yaml @@ -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.+)$' + routeFieldName: 'slug' + routeFieldResult: '{slug}' diff --git a/Configuration/Routes/BlogCategory.yaml b/Configuration/Routes/BlogCategory.yaml new file mode 100644 index 00000000..d4896570 --- /dev/null +++ b/Configuration/Routes/BlogCategory.yaml @@ -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.+)$' + routeFieldName: 'slug' + routeFieldResult: '{slug}' diff --git a/Configuration/Routes/BlogFeedWidget.yaml b/Configuration/Routes/BlogFeedWidget.yaml new file mode 100644 index 00000000..7651d90e --- /dev/null +++ b/Configuration/Routes/BlogFeedWidget.yaml @@ -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 diff --git a/Configuration/Routes/BlogTag.yaml b/Configuration/Routes/BlogTag.yaml new file mode 100644 index 00000000..c5757a32 --- /dev/null +++ b/Configuration/Routes/BlogTag.yaml @@ -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.+)$' + routeFieldName: 'slug' + routeFieldResult: '{slug}' diff --git a/Configuration/Routes/Default.yaml b/Configuration/Routes/Default.yaml index 8f0d8a27..8a367050 100644 --- a/Configuration/Routes/Default.yaml +++ b/Configuration/Routes/Default.yaml @@ -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.+)-(?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" }