From 780f018b51e7db2a700f98d79c281dbad74005e9 Mon Sep 17 00:00:00 2001 From: Benjamin Kott Date: Wed, 7 Aug 2019 22:49:16 +0200 Subject: [PATCH] [!!!][TASK] Add configuration error note for single view plugins (#94) To prevent the usage of plugins that should only be used on post views we are now adding additional checks for those. If no post could be resolved - also means if the plugin is used on pages that do not match the `Constants::DOKTYPE_BLOG_POST` - the plugins will now return a new message to make the miss usage visible. ``` A possible configuration error was detected. No matching post could be obtained. Make sure that this plugin is only used on a post. ``` The following plugins will now show this message if no post could be obtained: * Authors * Footer * Header * Metadata * RelatedPosts Templates added: * Layouts/Post.html Templates changed: * Templates/Comment/Comments.html * Templates/Comment/Form.html * Templates/Post/Authors.html * Templates/Post/Footer.html * Templates/Post/Header.html * Templates/Post/Metadata.html * Templates/Post/RelatedPosts.html Releases: master --- Classes/Controller/CommentController.php | 1 + Classes/Controller/PostController.php | 2 +- Resources/Private/Language/locallang.xlf | 8 +++++++ Resources/Private/Layouts/Post.html | 13 ++++++++++++ .../Private/Templates/Comment/Comments.html | 7 +++++-- Resources/Private/Templates/Comment/Form.html | 21 ++++++++++++------- Resources/Private/Templates/Post/Authors.html | 7 +++++-- Resources/Private/Templates/Post/Footer.html | 7 +++++-- Resources/Private/Templates/Post/Header.html | 7 +++++-- .../Private/Templates/Post/Metadata.html | 7 +++++-- .../Private/Templates/Post/RelatedPosts.html | 4 +++- 11 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 Resources/Private/Layouts/Post.html diff --git a/Classes/Controller/CommentController.php b/Classes/Controller/CommentController.php index 0b9a0574..90b744d8 100644 --- a/Classes/Controller/CommentController.php +++ b/Classes/Controller/CommentController.php @@ -83,6 +83,7 @@ public function commentsAction(): void $this->blogCacheService->addTagToPage('tx_blog_comment_' . $comment->getUid()); } $this->view->assign('comments', $comments); + $this->view->assign('post', $post); } } } diff --git a/Classes/Controller/PostController.php b/Classes/Controller/PostController.php index 30719d6b..e16a762d 100644 --- a/Classes/Controller/PostController.php +++ b/Classes/Controller/PostController.php @@ -363,7 +363,7 @@ public function relatedPostsAction(): void (int)$this->settings['relatedPosts']['limit'] ); $this->view->assign('type', 'related'); - $this->view->assign('currentPost', $post); + $this->view->assign('post', $post); $this->view->assign('posts', $posts); } diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 7afd455d..cbe9cf7f 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -4,6 +4,14 @@
+ + + A possible configuration error was detected. + + + No matching post could be obtained. Make sure that this plugin is only used on a post. + + Write comment diff --git a/Resources/Private/Layouts/Post.html b/Resources/Private/Layouts/Post.html new file mode 100644 index 00000000..0be2102f --- /dev/null +++ b/Resources/Private/Layouts/Post.html @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/Resources/Private/Templates/Comment/Comments.html b/Resources/Private/Templates/Comment/Comments.html index 42baa7d5..d3dde35e 100644 --- a/Resources/Private/Templates/Comment/Comments.html +++ b/Resources/Private/Templates/Comment/Comments.html @@ -1,4 +1,6 @@ - + + +

@@ -18,4 +20,5 @@

-
- - - - -
- + + + + +
+ + + + +
+
+ +
diff --git a/Resources/Private/Templates/Post/Authors.html b/Resources/Private/Templates/Post/Authors.html index 3c2482ae..fab32cf2 100644 --- a/Resources/Private/Templates/Post/Authors.html +++ b/Resources/Private/Templates/Post/Authors.html @@ -1,4 +1,6 @@ - + + + - + + diff --git a/Resources/Private/Templates/Post/Footer.html b/Resources/Private/Templates/Post/Footer.html index 2c313c94..4704aacb 100644 --- a/Resources/Private/Templates/Post/Footer.html +++ b/Resources/Private/Templates/Post/Footer.html @@ -1,4 +1,6 @@ - + + +
-
+ + diff --git a/Resources/Private/Templates/Post/Header.html b/Resources/Private/Templates/Post/Header.html index 4accd9e6..f93ca1d8 100644 --- a/Resources/Private/Templates/Post/Header.html +++ b/Resources/Private/Templates/Post/Header.html @@ -1,4 +1,6 @@ - + + +

{post.title}

@@ -7,4 +9,5 @@

{post.title}

- + + diff --git a/Resources/Private/Templates/Post/Metadata.html b/Resources/Private/Templates/Post/Metadata.html index b0c4a9e1..abf1287e 100644 --- a/Resources/Private/Templates/Post/Metadata.html +++ b/Resources/Private/Templates/Post/Metadata.html @@ -1,3 +1,6 @@ - + + + - + + diff --git a/Resources/Private/Templates/Post/RelatedPosts.html b/Resources/Private/Templates/Post/RelatedPosts.html index ee2de4a1..9a2ec9c6 100644 --- a/Resources/Private/Templates/Post/RelatedPosts.html +++ b/Resources/Private/Templates/Post/RelatedPosts.html @@ -1,4 +1,6 @@ - + + +