From 1cb07e710f9524e4226269f831476a4d6c407e3e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 9 Jul 2019 15:57:34 +0200 Subject: [PATCH] Link the article's comment count to the discussion --- com.woltlab.wcf/templates/article.tpl | 6 ++++-- .../discussion/CommentArticleDiscussionProvider.class.php | 7 +++++++ .../discussion/IArticleDiscussionProvider.class.php | 7 +++++++ .../discussion/VoidArticleDiscussionProvider.class.php | 7 +++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl index c4cca3639e..31e8509263 100644 --- a/com.woltlab.wcf/templates/article.tpl +++ b/com.woltlab.wcf/templates/article.tpl @@ -38,8 +38,10 @@ {if $article->getDiscussionProvider()->getDiscussionCountPhrase()}
  • - - {$article->getDiscussionProvider()->getDiscussionCountPhrase()} + + {if $article->getDiscussionProvider()->getDiscussionLink()}{else}{/if} + {$article->getDiscussionProvider()->getDiscussionCountPhrase()} + {if $article->getDiscussionProvider()->getDiscussionLink()}{else}{/if}
  • diff --git a/wcfsetup/install/files/lib/system/article/discussion/CommentArticleDiscussionProvider.class.php b/wcfsetup/install/files/lib/system/article/discussion/CommentArticleDiscussionProvider.class.php index 79a49d8439..163bdb05b1 100644 --- a/wcfsetup/install/files/lib/system/article/discussion/CommentArticleDiscussionProvider.class.php +++ b/wcfsetup/install/files/lib/system/article/discussion/CommentArticleDiscussionProvider.class.php @@ -28,6 +28,13 @@ class CommentArticleDiscussionProvider extends AbstractArticleDiscussionProvider return WCF::getLanguage()->getDynamicVariable('wcf.article.articleComments', ['article' => $this->article]); } + /** + * @inheritDoc + */ + public function getDiscussionLink() { + return ''; + } + /** * @inheritDoc */ diff --git a/wcfsetup/install/files/lib/system/article/discussion/IArticleDiscussionProvider.class.php b/wcfsetup/install/files/lib/system/article/discussion/IArticleDiscussionProvider.class.php index 2f93f94337..e53248de06 100644 --- a/wcfsetup/install/files/lib/system/article/discussion/IArticleDiscussionProvider.class.php +++ b/wcfsetup/install/files/lib/system/article/discussion/IArticleDiscussionProvider.class.php @@ -28,6 +28,13 @@ interface IArticleDiscussionProvider { */ public function getDiscussionCountPhrase(); + /** + * Returns the permalink to the discussions or an empty string if there is none. + * + * @return string + */ + public function getDiscussionLink(); + /** * Renders the input and display section of the associated discussion. * diff --git a/wcfsetup/install/files/lib/system/article/discussion/VoidArticleDiscussionProvider.class.php b/wcfsetup/install/files/lib/system/article/discussion/VoidArticleDiscussionProvider.class.php index d8c1e329d9..7c33eb37e8 100644 --- a/wcfsetup/install/files/lib/system/article/discussion/VoidArticleDiscussionProvider.class.php +++ b/wcfsetup/install/files/lib/system/article/discussion/VoidArticleDiscussionProvider.class.php @@ -27,6 +27,13 @@ class VoidArticleDiscussionProvider extends AbstractArticleDiscussionProvider { return ''; } + /** + * @inheritDoc + */ + public function getDiscussionLink() { + return ''; + } + /** * @inheritDoc */ -- 2.20.1