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

refactor: missing return types, qualifier imports, code cleanup

Übergeordneter 7dffaa21
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
3 Merge Requests!10feat!: quiqqer v2,!9feat!: quiqqer v2,!8feat!: quiqqer v2
...@@ -7,8 +7,12 @@ ...@@ -7,8 +7,12 @@
namespace QUI\FAQ\Controls; namespace QUI\FAQ\Controls;
use QUI; use QUI;
use QUI\Exception;
use QUI\Projects\Site;
use QUI\Projects\Site\Utils; use QUI\Projects\Site\Utils;
use function boolval;
/** /**
* Class Listing * Class Listing
* *
...@@ -22,7 +26,7 @@ class Accordion extends QUI\Control ...@@ -22,7 +26,7 @@ class Accordion extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
// default options // default options
$this->setAttributes([ $this->setAttributes([
...@@ -53,6 +57,7 @@ class Accordion extends QUI\Control ...@@ -53,6 +57,7 @@ class Accordion extends QUI\Control
* Can be overwritten * Can be overwritten
* *
* @return String * @return String
* @throws Exception
*/ */
public function getBody(): string public function getBody(): string
{ {
...@@ -61,10 +66,10 @@ class Accordion extends QUI\Control ...@@ -61,10 +66,10 @@ class Accordion extends QUI\Control
if ($this->getAttribute('parentSite')) { if ($this->getAttribute('parentSite')) {
try { try {
if ($this->getAttribute('parentSite') instanceof \QUI\Projects\Site) { if ($this->getAttribute('parentSite') instanceof Site) {
$FAQParentSite = $this->getAttribute('parentSite'); $FAQParentSite = $this->getAttribute('parentSite');
} else { } else {
$FAQParentSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('parentSite')); $FAQParentSite = Utils::getSiteByLink($this->getAttribute('parentSite'));
} }
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addInfo($Exception->getMessage()); QUI\System\Log::addInfo($Exception->getMessage());
...@@ -89,7 +94,7 @@ class Accordion extends QUI\Control ...@@ -89,7 +94,7 @@ class Accordion extends QUI\Control
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 = 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());
...@@ -135,7 +140,7 @@ class Accordion extends QUI\Control ...@@ -135,7 +140,7 @@ 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,
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
namespace QUI\FAQ; namespace QUI\FAQ;
use QUI\Exception;
use QUI\Interfaces\Projects\Site;
use QUI\Projects\Site\Edit; use QUI\Projects\Site\Edit;
/** /**
...@@ -19,20 +21,22 @@ class EventsHandler ...@@ -19,20 +21,22 @@ class EventsHandler
* event on child create * event on child create
* *
* @param integer $newId * @param integer $newId
* @param \QUI\Projects\Site\Edit $Parent * @param Site $Parent
* @throws Exception
*/ */
public static function onChildCreate($newId, $Parent) public static function onChildCreate(int $newId, Site $Parent): void
{ {
$type = $Parent->getAttribute('type'); $type = $Parent->getAttribute('type');
if ($type != 'quiqqer/faq:types/list' if (
$type != 'quiqqer/faq:types/list'
&& $type != 'quiqqer/faq:types/category' && $type != 'quiqqer/faq:types/category'
) { ) {
return; return;
} }
$Project = $Parent->getProject(); $Project = $Parent->getProject();
$Site = new Edit($Project, $newId); $Site = new Edit($Project, $newId);
if ($type == 'quiqqer/faq:types/list') { if ($type == 'quiqqer/faq:types/list') {
$Site->setAttribute('type', 'quiqqer/faq:types/category'); $Site->setAttribute('type', 'quiqqer/faq:types/category');
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
* FAQ Entry * FAQ Entry
*/ */
$Parent = $Site->getParent(); $Parent = $Site->getParent();
$parentType = $Parent->getAttribute('type'); $parentType = $Parent->getAttribute('type');
if ($parentType == 'quiqqer/faq:types/list' if (
$parentType == 'quiqqer/faq:types/list'
|| $parentType == 'quiqqer/faq:types/category' || $parentType == 'quiqqer/faq:types/category'
) { ) {
QUI::getRewrite()->showErrorHeader( QUI::getRewrite()->showErrorHeader(
......
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