From 7857325d9c5868e2af25bd53aa0a093a621853e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Sat, 27 Aug 2016 18:02:57 +0200 Subject: [PATCH] [core] set checkboxes default value to false MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- lib/Bridge.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Bridge.php b/lib/Bridge.php index 55c85c0..ff08d62 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -273,6 +273,23 @@ abstract class BridgeAbstract implements BridgeInterface { $this->returnClientError('Mixed context parameters'); }else{ $this->queriedContext=$queriedContext; + $contexts=array($this->queriedContext); + if(isset($this->parameters['global'])){ + $contexts[]='global'; + } + foreach($contexts as $context){ + foreach($this->parameters[$context] as $p=>$props){ + if(isset($props['type']) && + $props['type']==='checkbox' && + !isset($props['value'])){ + if(!isset($props['defaultValue'])){ + $this->parameters[$context][$p]['value']=false; + }else{ + $this->parameters[$context][$p]['value']=$props['defaultValue']; + } + } + } + } foreach($param as $name=>$value){ if(isset($this->parameters['global'][$name])){ $this->parameters[$queriedContext][$name]['value']=$value;