mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
656a9fbb4e
- Make statics private - Use Config::get rather than eval to read private statics - Add a helper function to expose UserDefinedForm_EmailRecipient::$summary_fields (to make them available for i18n).
32 lines
897 B
PHP
Executable File
32 lines
897 B
PHP
Executable File
<?php
|
|
/**
|
|
* EditableCheckbox
|
|
*
|
|
* A user modifiable checkbox on a UserDefinedForm
|
|
*
|
|
* @package userforms
|
|
*/
|
|
|
|
class EditableCheckbox extends EditableFormField {
|
|
|
|
private static $singular_name = 'Checkbox Field';
|
|
|
|
private static $plural_name = 'Checkboxes';
|
|
|
|
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;
|
|
}
|
|
|
|
public function getFormField() {
|
|
return new CheckboxField( $this->Name, $this->Title, $this->getSetting('Default'));
|
|
}
|
|
|
|
public function getValueFromData($data) {
|
|
$value = (isset($data[$this->Name])) ? $data[$this->Name] : false;
|
|
|
|
return ($value) ? _t('EditableFormField.YES', 'Yes') : _t('EditableFormField.NO', 'No');
|
|
}
|
|
} |