From a786bbd4e0d45a98446ed0384ed57705a17b89d3 Mon Sep 17 00:00:00 2001 From: mruac Date: Sun, 10 Sep 2023 11:45:05 +0930 Subject: [PATCH] DisplayAction: defaultchecked fix (#3654) * . * attempt to fix #2943 https://github.com/RSS-Bridge/rss-bridge/issues/2943 * Revert "." This reverts commit c0b6ccfea6ce873e9c9ce7c3600b3a96d9911468. * lint * Revert "attempt to fix #2943" This reverts commit 9f1a66e48d636a543e2171df212acf9731744bd0. * moved fix to BridgeAbstract --- lib/BridgeAbstract.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php index e58ddb91..2a6cd8ab 100644 --- a/lib/BridgeAbstract.php +++ b/lib/BridgeAbstract.php @@ -160,11 +160,7 @@ abstract class BridgeAbstract implements BridgeInterface switch ($type) { case 'checkbox': - if (!isset($properties['defaultValue'])) { - $this->inputs[$context][$name]['value'] = false; - } else { - $this->inputs[$context][$name]['value'] = $properties['defaultValue']; - } + $this->inputs[$context][$name]['value'] = $inputs[$context][$name]['value'] ?? false; break; case 'list': if (!isset($properties['defaultValue'])) { @@ -191,10 +187,14 @@ abstract class BridgeAbstract implements BridgeInterface foreach (static::PARAMETERS['global'] as $name => $properties) { if (isset($inputs[$name])) { $value = $inputs[$name]; - } elseif (isset($properties['defaultValue'])) { - $value = $properties['defaultValue']; } else { - continue; + if ($properties['type'] === 'checkbox') { + $value = false; + } elseif (isset($properties['defaultValue'])) { + $value = $properties['defaultValue']; + } else { + continue; + } } $this->inputs[$queriedContext][$name]['value'] = $value; }