Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit 7dffaa21 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

style: code style

Übergeordneter 505e552f
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
3 Merge Requests!10feat!: quiqqer v2,!9feat!: quiqqer v2,!8feat!: quiqqer v2
...@@ -26,23 +26,23 @@ class Accordion extends QUI\Control ...@@ -26,23 +26,23 @@ class Accordion extends QUI\Control
{ {
// default options // default options
$this->setAttributes([ $this->setAttributes([
'class' => 'quiqqer-faqAccordion', 'class' => 'quiqqer-faqAccordion',
'order' => 'order_field', 'order' => 'order_field',
'stayOpen' => true, // if true make accordion items stay open when another item is opened 'stayOpen' => true, // if true make accordion items stay open when another item is opened
'openFirst' => true, // the first entry is initially opened 'openFirst' => true, // the first entry is initially opened
'listMaxWidth' => 0, // positive numbers only, 0 disabled this option. 'listMaxWidth' => 0, // positive numbers only, 0 disabled this option.
'max' => 10, // max entries 'max' => 10, // max entries
'parentSite' => null, 'parentSite' => null,
'siteType' => 'quiqqer/faq:types/entry', 'siteType' => 'quiqqer/faq:types/entry',
'showMoreButton' => false, 'showMoreButton' => false,
'moreSite' => '', 'moreSite' => '',
'useFaqStructuredData' => false 'useFaqStructuredData' => false
]); ]);
parent::__construct($attributes); parent::__construct($attributes);
$this->addCSSFile( $this->addCSSFile(
dirname(__FILE__).'/Accordion.css' dirname(__FILE__) . '/Accordion.css'
); );
$this->setAttribute('cacheable', 0); $this->setAttribute('cacheable', 0);
...@@ -57,7 +57,7 @@ class Accordion extends QUI\Control ...@@ -57,7 +57,7 @@ class Accordion extends QUI\Control
public function getBody(): string public function getBody(): string
{ {
$FAQParentSite = null; $FAQParentSite = null;
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
if ($this->getAttribute('parentSite')) { if ($this->getAttribute('parentSite')) {
try { try {
...@@ -76,7 +76,7 @@ class Accordion extends QUI\Control ...@@ -76,7 +76,7 @@ class Accordion extends QUI\Control
$faqSites = $FAQParentSite->getChildren([ $faqSites = $FAQParentSite->getChildren([
'where' => [ 'where' => [
'active' => 1, 'active' => 1,
'type' => $this->getAttribute('siteType'), 'type' => $this->getAttribute('siteType'),
], ],
'limit' => $this->getAttribute('max'), 'limit' => $this->getAttribute('max'),
'order' => $this->getAttribute('order') 'order' => $this->getAttribute('order')
...@@ -84,12 +84,12 @@ class Accordion extends QUI\Control ...@@ -84,12 +84,12 @@ class Accordion extends QUI\Control
// show "more faq" link // show "more faq" link
$showMoreButton = $this->getAttribute('showMoreButton'); $showMoreButton = $this->getAttribute('showMoreButton');
$MoreSite = $FAQParentSite; $MoreSite = $FAQParentSite;
if ($showMoreButton || $this->getAttribute('moreSite')) { if ($showMoreButton || $this->getAttribute('moreSite')) {
if ($this->getAttribute('moreSite')) { if ($this->getAttribute('moreSite')) {
try { try {
$MoreSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('moreSite')); $MoreSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('moreSite'));
$showMoreButton = true; $showMoreButton = true;
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addInfo($Exception->getMessage()); QUI\System\Log::addInfo($Exception->getMessage());
...@@ -99,7 +99,7 @@ class Accordion extends QUI\Control ...@@ -99,7 +99,7 @@ class Accordion extends QUI\Control
$countFaqEntries = $FAQParentSite->getChildren([ $countFaqEntries = $FAQParentSite->getChildren([
'where' => [ 'where' => [
'active' => 1, 'active' => 1,
'type' => $this->getAttribute('siteType'), 'type' => $this->getAttribute('siteType'),
], ],
'count' => 1 'count' => 1
]); ]);
...@@ -113,21 +113,21 @@ class Accordion extends QUI\Control ...@@ -113,21 +113,21 @@ class Accordion extends QUI\Control
$entries = []; $entries = [];
foreach ($faqSites as $FaqSite) { foreach ($faqSites as $FaqSite) {
$short = $FaqSite->getAttribute('short'); $short = $FaqSite->getAttribute('short');
$content = $FaqSite->getAttribute('content'); $content = $FaqSite->getAttribute('content');
if ($short) { if ($short) {
$short = '<div class="quiqqer-faqAccordion-item-content-pageShort text-muted">'.$short.'</div>'; $short = '<div class="quiqqer-faqAccordion-item-content-pageShort text-muted">' . $short . '</div>';
} }
if ($content) { if ($content) {
$content = '<div class="quiqqer-faqAccordion-item-content-pageContent">'.$content.'</div>'; $content = '<div class="quiqqer-faqAccordion-item-content-pageContent">' . $content . '</div>';
} }
$entryContent = $short.$content; $entryContent = $short . $content;
$entry = [ $entry = [
'entryTitle' => $FaqSite->getAttribute('title'), 'entryTitle' => $FaqSite->getAttribute('title'),
'entryContent' => $entryContent, 'entryContent' => $entryContent,
]; ];
...@@ -135,22 +135,22 @@ class Accordion extends QUI\Control ...@@ -135,22 +135,22 @@ class Accordion extends QUI\Control
} }
$Accordion = new QUI\Bricks\Controls\Accordion([ $Accordion = new QUI\Bricks\Controls\Accordion([
'stayOpen' => \boolval($this->getAttribute('stayOpen')), 'stayOpen' => \boolval($this->getAttribute('stayOpen')),
'openFirst' => $this->getAttribute('openFirst'), 'openFirst' => $this->getAttribute('openFirst'),
'listMaxWidth' => $this->getAttribute('listMaxWidth'), 'listMaxWidth' => $this->getAttribute('listMaxWidth'),
'entries' => $entries, 'entries' => $entries,
'useFaqStructuredData' => $this->getAttribute('useFaqStructuredData'), 'useFaqStructuredData' => $this->getAttribute('useFaqStructuredData'),
]); ]);
$this->addCSSFiles($Accordion->getCSSFiles()); $this->addCSSFiles($Accordion->getCSSFiles());
$Engine->assign([ $Engine->assign([
'this' => $this, 'this' => $this,
'Accordion' => $Accordion, 'Accordion' => $Accordion,
'showMoreButton' => $showMoreButton, 'showMoreButton' => $showMoreButton,
'MoreSite' => $MoreSite 'MoreSite' => $MoreSite
]); ]);
return $Engine->fetch(dirname(__FILE__).'/Accordion.html'); return $Engine->fetch(dirname(__FILE__) . '/Accordion.html');
} }
} }
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren