mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Added placeholder support for the EditableTextField
This commit is contained in:
parent
5288c4d441
commit
fc16557b1d
@ -16,7 +16,8 @@ class EditableTextField extends EditableFormField {
|
||||
private static $db = array(
|
||||
'MinLength' => 'Int',
|
||||
'MaxLength' => 'Int',
|
||||
'Rows' => 'Int(1)'
|
||||
'Rows' => 'Int(1)',
|
||||
'Placeholder' => 'Varchar(255)'
|
||||
);
|
||||
|
||||
private static $defaults = array(
|
||||
@ -35,6 +36,14 @@ class EditableTextField extends EditableFormField {
|
||||
'Fields with more than one row will be generated as a textarea'
|
||||
))
|
||||
);
|
||||
|
||||
$fields->addFieldToTab(
|
||||
'Root.Main',
|
||||
TextField::create(
|
||||
'Placeholder',
|
||||
_t('EditableTextField.PLACEHOLDER', 'Placeholder')
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
return parent::getCMSFields();
|
||||
@ -95,5 +104,9 @@ class EditableTextField extends EditableFormField {
|
||||
if($this->MaxLength) {
|
||||
$field->setAttribute('data-rule-maxlength', $this->MaxLength);
|
||||
}
|
||||
|
||||
if($this->Placeholder) {
|
||||
$field->setAttribute('placeholder', $this->Placeholder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ de_DE:
|
||||
PLURALNAME: 'Textfelder'
|
||||
SINGULARNAME: 'Textfeld'
|
||||
TEXTLENGTH: 'Textlänge'
|
||||
PLACEHOLDER: 'Platzhalter'
|
||||
EditableUploadField:
|
||||
SELECTUPLOADFOLDER: 'Ordner für den Upload auswählen'
|
||||
FieldEditor:
|
||||
|
@ -141,6 +141,7 @@ en:
|
||||
RANGE_TO: to
|
||||
SINGULARNAME: 'Text Field'
|
||||
TEXTLENGTH: 'Allowed text length'
|
||||
PLACEHOLDER: 'Placeholder'
|
||||
EditableUploadField:
|
||||
SELECTUPLOADFOLDER: 'Select upload folder'
|
||||
FieldEditor:
|
||||
|
Loading…
Reference in New Issue
Block a user