mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Issue #4086 Boolean admin-ui form element readParm/writeParm consistency.
This commit is contained in:
parent
aaae9d0e0d
commit
ca61cd7de5
@ -5488,10 +5488,27 @@ var_dump($select_options);*/
|
||||
|
||||
break;
|
||||
|
||||
/**
|
||||
* $parms['true'] - label to use for true
|
||||
* $parms['false'] - label to use for false
|
||||
* $parms['enabled'] - alias of $parms['true']
|
||||
* $parms['disabled'] - alias of $parms['false']
|
||||
* $parms['reverse'] - use 0 for true and 1 for false.
|
||||
*/
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
$false = vartrue($parms['trueonly']) ? "" : ADMIN_FALSE_ICON;
|
||||
|
||||
if(!empty($parms['enabled']))
|
||||
{
|
||||
$parms['true'] = $parms['enabled'];
|
||||
}
|
||||
|
||||
if(!empty($parms['disabled']))
|
||||
{
|
||||
$parms['false'] = $parms['disabled'];
|
||||
}
|
||||
|
||||
if(!vartrue($attributes['noedit']) && vartrue($parms['editable']) && !vartrue($parms['link'])) // avoid bad markup, better solution coming up
|
||||
{
|
||||
if(isset($parms['false'])) // custom representation for 'false'. (supports font-awesome when set by css)
|
||||
@ -6258,8 +6275,13 @@ var_dump($select_options);*/
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* $parms['true'] - label to use for true
|
||||
* $parms['false'] - label to use for false
|
||||
* $parms['enabled'] - alias of $parms['true']
|
||||
* $parms['disabled'] - alias of $parms['false']
|
||||
* $parms['label'] - when set to 'yesno' uses yes/no instead of enabled/disabled
|
||||
*/
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
|
||||
@ -6274,6 +6296,17 @@ var_dump($select_options);*/
|
||||
$ldisabled = (!empty($parms['disabled']) && is_string($parms['disabled'])) ? $parms['disabled'] : 'LAN_OFF';
|
||||
}
|
||||
|
||||
if(!empty($parms['true']))
|
||||
{
|
||||
$lenabled = $parms['true'];
|
||||
}
|
||||
|
||||
if(!empty($parms['false']))
|
||||
{
|
||||
$ldisabled = $parms['false'];
|
||||
}
|
||||
|
||||
|
||||
unset($parms['enabled'], $parms['disabled'], $parms['label']);
|
||||
$ret = vartrue($parms['pre']).$this->radio_switch($key, $value, defset($lenabled, $lenabled), defset($ldisabled, $ldisabled),$parms).vartrue($parms['post']);
|
||||
break;
|
||||
|
@ -32,7 +32,7 @@ class e_formTest extends \Codeception\Test\Unit
|
||||
// 'number_002' => array('title'=> "Number 002", 'type' => 'number', 'inline'=>true, 'writeParms'=>array('min'=>0)),
|
||||
|
||||
'bool_001' => array('title'=> "Bool 001", 'type' => 'bool', 'writeParms'=>array('size'=>'xlarge')),
|
||||
// 'bool_002' => array('title'=> "Bool 002", 'type' => 'bool', 'inline'=>true, 'writeParms'=>array('size'=>'xlarge')),
|
||||
// 'bool_002' => array('title'=> "Bool 002", 'type' => 'bool', 'inline'=>true, 'readParms' => array ('enabled'=>'TÉMA', 'disabled'=>'ČLÁNOK'), 'writeParms' => array ('enabled'=>'TÉMA', 'disabled'=>'ČLÁNOK'), ),
|
||||
|
||||
'dropdown_001' => array('title'=>'Dropdown 001', 'type'=>'dropdown', 'tab'=>1, 'writeParms' => array('optArray'=>array('opt_value_1'=>'Label 1', 'opt_value_2'=>'Label 2')) ),
|
||||
'dropdown_002' => array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user