Added placeholder support for the EditableTextField

This commit is contained in:
Marco Kernler 2015-08-27 13:54:28 +02:00
parent 5288c4d441
commit fc16557b1d
3 changed files with 16 additions and 1 deletions

View File

@ -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);
}
}
}

View File

@ -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:

View File

@ -141,6 +141,7 @@ en:
RANGE_TO: to
SINGULARNAME: 'Text Field'
TEXTLENGTH: 'Allowed text length'
PLACEHOLDER: 'Placeholder'
EditableUploadField:
SELECTUPLOADFOLDER: 'Select upload folder'
FieldEditor: