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