From 2859fff92ab1d4186bcfffe2e2e70bed5d75c645 Mon Sep 17 00:00:00 2001 From: Michael Danielczok <michael@pcsg.de> Date: Thu, 4 Jul 2024 21:53:52 +0200 Subject: [PATCH] fix(Accordion): consider empty local variable --- src/QUI/Bricks/Controls/Accordion.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/QUI/Bricks/Controls/Accordion.php b/src/QUI/Bricks/Controls/Accordion.php index 038ed92..fabf7ec 100644 --- a/src/QUI/Bricks/Controls/Accordion.php +++ b/src/QUI/Bricks/Controls/Accordion.php @@ -53,7 +53,7 @@ public function __construct($attributes = []) * * @see \QUI\Control::create() */ - public function getBody() + public function getBody(): string { $Engine = QUI::getTemplateManager()->getEngine(); $entries = $this->getAttribute('entries'); @@ -102,10 +102,18 @@ public function getBody() * @return string * @throws QUI\Exception */ - public function createJSONLDFAQSchemaCode() + public function createJSONLDFAQSchemaCode(): string { $Engine = QUI::getTemplateManager()->getEngine(); + if (empty($this->entries)) { + $this->entries = $this->getAttribute('entries'); + } + + if (empty($this->entries)) { + return ''; + } + $Engine->assign([ 'this' => $this, 'entries' => $this->entries -- GitLab