Skip to content
Code-Schnipsel Gruppen Projekte
Commit a38f46de erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

feat: New setting for Accordion FAQ control --> select site for more entries..

Übergeordneter b1b8d7e4
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -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>
......
......@@ -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>
......@@ -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>
......
......@@ -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');
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren