IMPR: Form placeholders

This commit is contained in:
Tony Air 2021-07-09 15:04:46 +02:00
parent f13643afca
commit 4d8ab97973

View File

@ -19,13 +19,16 @@ class PlaceholderFormExtension extends Extension
private function setPlaceholder($field) private function setPlaceholder($field)
{ {
if (is_a($field, TextField::class)) { if (is_a($field, TextField::class)) {
if (!$field->getAttribute('placeholder')) {
$placeholder = $field->Title() .($field->hasClass('requiredField') ? '*' : '');
$field->setAttribute( $field->setAttribute(
'placeholder', 'placeholder',
$field->Title() $placeholder
.($field->hasClass('requiredField') ? '*' : '')
); );
$field->setTitle(''); $field->setTitle('');
} }
}
if (is_a($field, CompositeField::class)) { if (is_a($field, CompositeField::class)) {
$children = $field->getChildren(); $children = $field->getChildren();