2008-09-29 03:18:23 +00:00
< ? php
/**
* EditableCheckbox
* A user modifiable checkbox on a UserDefinedForm
2009-04-17 02:26:40 +00:00
*
* @ package userforms
2008-09-29 03:18:23 +00:00
*/
2009-12-07 02:04:20 +00:00
2008-09-29 03:18:23 +00:00
class EditableCheckbox extends EditableFormField {
2009-05-06 03:34:40 +00:00
static $singular_name = 'Checkbox Field' ;
2008-09-29 03:18:23 +00:00
2009-04-25 02:54:10 +00:00
static $plural_name = 'Checkboxes' ;
2008-09-29 03:18:23 +00:00
2009-05-06 03:34:40 +00:00
public function getFieldConfiguration () {
$options = parent :: getFieldConfiguration ();
$options -> push ( new CheckboxField ( " Fields[ $this->ID ][CustomSettings][Default] " , _t ( 'EditableFormField.CHECKEDBYDEFAULT' , 'Checked by Default?' ), $this -> getSetting ( 'Default' )));
return $options ;
2008-09-29 03:18:23 +00:00
}
2009-04-27 06:00:05 +00:00
public function getFormField () {
return new CheckboxField ( $this -> Name , $this -> Title , $this -> getSetting ( 'Default' ));
2008-09-29 03:18:23 +00:00
}
2009-05-06 03:34:40 +00:00
public function getValueFromData ( $data ) {
$value = ( isset ( $data [ $this -> Name ])) ? $data [ $this -> Name ] : false ;
return ( $value ) ? _t ( 'EditableFormField.YES' , 'Yes' ) : _t ( 'EditableFormField.NO' , 'No' );
}
2009-12-07 02:04:20 +00:00
}