1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-17 03:54:09 +02:00

Form Handler: renderElement() and renderValue() now support json values. (used by Pages/Menus custom fields)

This commit is contained in:
Cameron
2017-01-22 13:31:03 -08:00
parent 3e9624be81
commit 2c2b9d4091
4 changed files with 148 additions and 22 deletions

View File

@@ -3893,8 +3893,14 @@ class e_form
$parms = $attributes['readParms'];
}
// @see custom fields in cpage which accept json params.
if(!empty($attributes['writeParms']) && $tmpOpt = e107::getParser()->isJSON($attributes['writeParms']))
{
$attributes['writeParms'] = $tmpOpt;
unset($tmpOpt);
}
if(!empty($attributes['inline'])) $parms['editable'] = true; // attribute alias
if(!empty($attributes['sort'])) $parms['sort'] = true; // attribute alias
@@ -3998,9 +4004,15 @@ class e_form
break;
case 'checkboxes':
$value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect').'['.$id.']', $id);
//$attributes['type'] = 'text';
return $value;
if(empty($attributes['writeParms'])) // avoid comflicts with a field called 'checkboxes'
{
$value = $this->checkbox(vartrue($attributes['toggle'], 'multiselect').'['.$id.']', $id);
return $value;
}
break;
}
@@ -4102,7 +4114,7 @@ class e_form
$opts['multiple'] = true;
}
if(vartrue($opts['multiple']))
if(!empty($opts['multiple']))
{
$ret = array();
$value = is_array($value) ? $value : explode(',', $value);
@@ -4111,6 +4123,8 @@ class e_form
if(isset($wparms[$v])) $ret[] = $wparms[$v];
}
$value = implode(', ', $ret);
}
else
{
@@ -4857,10 +4871,14 @@ class e_form
{
$tp = e107::getParser();
$parms = vartrue($attributes['writeParms'], array());
if($tmpOpt = $tp->isJSON($parms))
{
$parms = $tmpOpt;
unset($tmpOpt);
}
if(is_string($parms)) parse_str($parms, $parms);
$ajaxParms = array();