diff --git a/bricks.xml b/bricks.xml index 84001ac7342af325982580db79eaf7d3d3e8ca1e..d4c895fe69c34f05e6e442357198695aa6eabcef 100644 --- a/bricks.xml +++ b/bricks.xml @@ -89,6 +89,14 @@ </description> </setting> + <!-- more site --> + <setting name="moreSite" class="project-site"> + <locale group="quiqqer/faq" var="brick.accordion.settings.moreSite"/> + <description> + <locale group="quiqqer/faq" var="brick.accordion.settings.moreSite.desc"/> + </description> + </setting> + </settings> </brick> </bricks> diff --git a/locale.xml b/locale.xml index f85546e98d3d55c987cd03fd6718ea78e7550816..5b4a79def5c2f08877bd94a7aa6d015f7573c4b2 100644 --- a/locale.xml +++ b/locale.xml @@ -103,8 +103,8 @@ <en><![CDATA[FAQ category site]]></en> </locale> <locale name="brick.accordion.settings.site.desc"> - <de><![CDATA[Nur die FAQ-Einträge der Seite werden beachtet.]]></de> - <en><![CDATA[Only the FAQ entries of the page are listed.]]></en> + <de><![CDATA[Nur die Unterseiten vom Typ "FAQ-Eintrag" werden angezeigt.]]></de> + <en><![CDATA[Only the subpages of the "FAQ Entry" type are displayed.]]></en> </locale> <locale name="brick.accordion.settings.order"> <de><![CDATA[Reihenfolge]]></de> @@ -150,5 +150,13 @@ <de><![CDATA[Weitere FAQ Einträge]]></de> <en><![CDATA[More FAQ entries]]></en> </locale> + <locale name="brick.accordion.settings.moreSite"> + <de><![CDATA["Weitere Einträge" Seite]]></de> + <en><![CDATA["More entries" site]]></en> + </locale> + <locale name="brick.accordion.settings.moreSite.desc" html="true"> + <de><![CDATA[Seite mit weiteren Informationen. Wenn ausgewählt, wird der Button "Weitere Einträge" unter der FAQ List <strong>immer</strong> angezeigt.]]></de> + <en><![CDATA[Page with further information. If selected, the "More entries" button will <strong>always</strong> be displayed below the FAQ List.]]></en> + </locale> </groups> </locales> diff --git a/src/QUI/FAQ/Controls/Accordion.html b/src/QUI/FAQ/Controls/Accordion.html index 328e2438b5b9d06e07045bb48492762243fe29f7..6d0ef3f2506fb05f1702e4c38295e3928543fea8 100644 --- a/src/QUI/FAQ/Controls/Accordion.html +++ b/src/QUI/FAQ/Controls/Accordion.html @@ -15,7 +15,7 @@ {if $showMoreButton} <div class="quiqqer-faqAccordion-moreButton"> - <a href="{url site=$FAQParentSite}" title="{$FAQParentSite->getAttribute('title')}"> + <a href="{url site=$MoreSite}" title="{$MoreSite->getAttribute('title')}"> {locale group="quiqqer/faq" var="brick.accordion.button.more"} </a> </div> diff --git a/src/QUI/FAQ/Controls/Accordion.php b/src/QUI/FAQ/Controls/Accordion.php index ab02df596904ac22039c69c62de71f4fc07737de..ab5d4f35e93f2eac029f4ae87b07dbb28c7e7a68 100644 --- a/src/QUI/FAQ/Controls/Accordion.php +++ b/src/QUI/FAQ/Controls/Accordion.php @@ -34,7 +34,8 @@ class Accordion extends QUI\Control 'max' => 10, // max entries 'parentSite' => null, 'siteType' => 'quiqqer/faq:types/entry', - 'showMoreButton' => false + 'showMoreButton' => false, + 'moreSite' => '' ]); parent::__construct($attributes); @@ -65,7 +66,7 @@ class Accordion extends QUI\Control $FAQParentSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('parentSite')); } } catch (QUI\Exception $Exception) { - QUI\System\Log::addDebug($Exception->getMessage()); + QUI\System\Log::addInfo($Exception->getMessage()); return ''; } @@ -82,18 +83,29 @@ class Accordion extends QUI\Control // show "more faq" link $showMoreButton = $this->getAttribute('showMoreButton'); - - if ($showMoreButton) { - $countFaqEntries = $FAQParentSite->getChildren([ - 'where' => [ - 'active' => 1, - 'type' => $this->getAttribute('siteType'), - ], - 'count' => 1 - ]); - - if ($countFaqEntries <= $this->getAttribute('max')) { - $showMoreButton = false; + $MoreSite = $FAQParentSite; + + if ($showMoreButton || $this->getAttribute('moreSite')) { + if ($this->getAttribute('moreSite')) { + try { + $MoreSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('moreSite')); + $showMoreButton = true; + } catch (QUI\Exception $Exception) { + QUI\System\Log::addInfo($Exception->getMessage()); + $MoreSite = null; + } + } else { + $countFaqEntries = $FAQParentSite->getChildren([ + 'where' => [ + 'active' => 1, + 'type' => $this->getAttribute('siteType'), + ], + 'count' => 1 + ]); + + if ($countFaqEntries <= $this->getAttribute('max')) { + $showMoreButton = false; + } } } @@ -134,7 +146,7 @@ class Accordion extends QUI\Control 'this' => $this, 'Accordion' => $Accordion, 'showMoreButton' => $showMoreButton, - 'FAQParentSite' => $FAQParentSite + 'MoreSite' => $MoreSite ]); return $Engine->fetch(dirname(__FILE__).'/Accordion.html');