From 960aebdbc4c7d8b61ced0e545cc1facc02f7f168 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 3 Apr 2011 17:25:44 -0700 Subject: [PATCH] QnA - add best class to best answers --- plugins/QnA/QnAPlugin.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/QnA/QnAPlugin.php b/plugins/QnA/QnAPlugin.php index e53d56928c..f3a07f13c5 100644 --- a/plugins/QnA/QnAPlugin.php +++ b/plugins/QnA/QnAPlugin.php @@ -300,7 +300,6 @@ class QnAPlugin extends MicroAppPlugin function onStartOpenNoticeListItemElement($nli) { - $type = $nli->notice->object_type; switch($type) @@ -318,9 +317,18 @@ class QnAPlugin extends MicroAppPlugin break; case QnA_Answer::OBJECT_TYPE: $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id; + + $classes = array('hentry', 'notice', 'answer'); + + $answer = QnA_Answer::staticGet('uri', $notice->uri); + + if (!empty($answer) && (boolean($answer->best))) { + $classes[] = 'best'; + } + $nli->out->elementStart( 'li', array( - 'class' => 'hentry notice answer', + 'class' => implode(' ', $classes), 'id' => 'notice-' . $id ) ); @@ -367,8 +375,6 @@ class QnAPlugin extends MicroAppPlugin $nli = new NoticeListItem($notice, $out); $nli->showNotice(); - - $out->elementStart('div', array('class' => 'entry-content question-desciption')); $question = QnA_Question::getByNotice($notice); -- 2.39.5