diff --git a/files/lib/data/faq/category/FaqCategory.class.php b/files/lib/data/faq/category/FaqCategory.class.php index 2c79195..02a2ac7 100644 --- a/files/lib/data/faq/category/FaqCategory.class.php +++ b/files/lib/data/faq/category/FaqCategory.class.php @@ -13,6 +13,7 @@ use wcf\system\request\LinkHandler; use wcf\system\style\FontAwesomeIcon; use wcf\system\WCF; +use wcf\util\StringUtil; /** * @method FaqCategory[] getChildCategories() @@ -86,7 +87,17 @@ public function getLink(): string ]); } - public function getIcon(int $size = 24): string + public function getDescription(): string + { + return WCF::getLanguage()->get($this->description); + } + + public function getDescriptionHtml(): string + { + return $this->descriptionUseHtml ? $this->getDescription() : StringUtil::encodeHTML($this->getDescription()); + } + + public function getIcon(int $size = 24, bool $defaultIcon = false): string { if ( isset($this->additionalData['faqIcon']) @@ -95,6 +106,10 @@ public function getIcon(int $size = 24): string return FontAwesomeIcon::fromString($this->additionalData['faqIcon'])->toHtml($size); } + if ($defaultIcon) { + return FontAwesomeIcon::fromString('circle-question;false')->toHtml($size); + } + return ''; } } diff --git a/files/lib/page/FaqQuestionListPage.class.php b/files/lib/page/FaqQuestionListPage.class.php index c03bd7b..38a6d1c 100644 --- a/files/lib/page/FaqQuestionListPage.class.php +++ b/files/lib/page/FaqQuestionListPage.class.php @@ -74,11 +74,8 @@ public function readData() } $faq = [ - 'id' => $category->categoryID, - 'title' => WCF::getLanguage()->get($category->title), + 'category' => $category, 'attachments' => $attachmentList, - 'icon24' => $category->getIcon(24), - 'icon64' => $category->getIcon(64), 'questions' => [], ]; diff --git a/files/lib/system/category/FaqCategoryType.class.php b/files/lib/system/category/FaqCategoryType.class.php index fb663c4..dcb924d 100644 --- a/files/lib/system/category/FaqCategoryType.class.php +++ b/files/lib/system/category/FaqCategoryType.class.php @@ -14,7 +14,7 @@ final class FaqCategoryType extends AbstractCategoryType /** * @inheritDoc */ - protected $hasDescription = false; + protected $hasDescription = true; /** * @inheritDoc @@ -42,7 +42,14 @@ final class FaqCategoryType extends AbstractCategoryType protected function init() { $this->maximumNestingLevel = SIMPLE_FAQ_VIEW === 'gallery' ? 0 : 1; + $this->hasDescription = SIMPLE_FAQ_VIEW === 'gallery' ? false : true; parent::init(); } + + #[Override] + public function supportsHtmlDescription() + { + return SIMPLE_FAQ_VIEW === 'gallery' ? false : true; + } } diff --git a/files/style/faq.scss b/files/style/faq.scss index 926fd7a..0572943 100644 --- a/files/style/faq.scss +++ b/files/style/faq.scss @@ -43,18 +43,22 @@ } .faq { - > h2 { - font-size: 1.5rem; - border-bottom: 1px solid currentColor; - padding-bottom: 10px + > .sectionHeader { + h2 { + font-size: 1.5rem !important; + } + border-bottom: 1px solid currentColor !important; + padding-bottom: 10px; } > .sub { margin-top: 16px; margin-bottom: 8px; margin-left: 16px; - > h2 { - font-size: 1.3rem; - border-bottom: 1px solid currentColor; + .sectionHeader { + h2 { + font-size: 1.3rem !important; + } + border-bottom: 1px solid currentColor !important; padding-bottom: 10px; } } diff --git a/templates/faqQuestionList.tpl b/templates/faqQuestionList.tpl index 98555db..9538d0d 100644 --- a/templates/faqQuestionList.tpl +++ b/templates/faqQuestionList.tpl @@ -23,13 +23,9 @@
{foreach from=$faqs item=faq} {if ($faq['questions']|isset && $faq['questions']|count)} - {/if} {/foreach} @@ -46,8 +42,8 @@ {if ($faq['questions']|isset && $faq['questions']|count)} {assign var='attachmentList' value=$faq['attachments']} -