[core] set checkboxes default value to false

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-08-27 18:02:57 +02:00
parent 72e3031d5c
commit 7857325d9c

View file

@ -273,6 +273,23 @@ abstract class BridgeAbstract implements BridgeInterface {
$this->returnClientError('Mixed context parameters'); $this->returnClientError('Mixed context parameters');
}else{ }else{
$this->queriedContext=$queriedContext; $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){ foreach($param as $name=>$value){
if(isset($this->parameters['global'][$name])){ if(isset($this->parameters['global'][$name])){
$this->parameters[$queriedContext][$name]['value']=$value; $this->parameters[$queriedContext][$name]['value']=$value;