Add custom field type 'Float'.

It understands options precision, min & max, so for example:
precision=2
max=20
This commit is contained in:
Nathan Gray 2011-03-28 22:43:39 +00:00
parent 28eeaa0bdd
commit c714b06848

View File

@ -45,6 +45,7 @@ class customfields_widget
*/ */
var $cf_types = array( var $cf_types = array(
'text' => 'Text', 'text' => 'Text',
'float' => 'Float',
'label' => 'Label', 'label' => 'Label',
'select' => 'Selectbox', 'select' => 'Selectbox',
'ajax_select' => 'Search', 'ajax_select' => 'Search',
@ -312,6 +313,13 @@ class customfields_widget
unset($radio); unset($radio);
} }
break; break;
case 'float':
$known_options = array('min'=>null, 'max'=>null,'size' => $field['len'], 'precision' => null);
$options = array_merge($known_options, $field['values']);
$input =& etemplate::empty_cell($field['type'],$this->prefix.$lname,array(
'size' => implode(',',$options)
));
break;
case 'text' : case 'text' :
case 'textarea' : case 'textarea' :
case '' : // not set case '' : // not set