mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
NEW: Added a numeric field and associated png
NEW: Setup translations for number field NEW: extend fromEditableTextfield use number class
This commit is contained in:
parent
f90b997c29
commit
938d2059fa
34
code/model/formfields/EditableNumericField.php
Executable file
34
code/model/formfields/EditableNumericField.php
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* EditableNumericField
|
||||||
|
*
|
||||||
|
* This control represents a user-defined numeric field in a user defined form
|
||||||
|
*
|
||||||
|
* @package userforms
|
||||||
|
*/
|
||||||
|
|
||||||
|
class EditableNumericField extends EditableTextField {
|
||||||
|
|
||||||
|
private static $singular_name = 'Numeric Field';
|
||||||
|
|
||||||
|
private static $plural_name = 'Numeric Fields';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TextareaField|TextField
|
||||||
|
*/
|
||||||
|
public function getFormField() {
|
||||||
|
if($this->getSetting('Rows') && $this->getSetting('Rows') > 1) {
|
||||||
|
$taf = new NumericField($this->Name, $this->Title);
|
||||||
|
$taf->setRows($this->getSetting('Rows'));
|
||||||
|
$taf->addExtraClass('number');
|
||||||
|
return $taf;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$taf = new NumericField($this->Name, $this->Title, null, $this->getSetting('MaxLength'));
|
||||||
|
$taf->addExtraClass('number');
|
||||||
|
return $taf;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
images/editablenumericfield.png
Normal file
BIN
images/editablenumericfield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 525 B |
@ -102,6 +102,11 @@ en:
|
|||||||
PLURALNAME: 'Text Fields'
|
PLURALNAME: 'Text Fields'
|
||||||
SINGULARNAME: 'Text Field'
|
SINGULARNAME: 'Text Field'
|
||||||
TEXTLENGTH: 'Text length'
|
TEXTLENGTH: 'Text length'
|
||||||
|
EditableNumericField:
|
||||||
|
NUMBERROWS: 'Number of rows'
|
||||||
|
PLURALNAME: 'Number Fields'
|
||||||
|
SINGULARNAME: 'Number Field'
|
||||||
|
TEXTLENGTH: 'Number length'
|
||||||
EditableUploadField:
|
EditableUploadField:
|
||||||
SELECTUPLOADFOLDER: 'Select upload folder'
|
SELECTUPLOADFOLDER: 'Select upload folder'
|
||||||
FieldEditor:
|
FieldEditor:
|
||||||
|
Loading…
Reference in New Issue
Block a user