IMPR: Allow to show field labels

This commit is contained in:
Tony Air 2022-06-27 16:00:40 +02:00
parent 6d82e2826f
commit f37d4b2e92
2 changed files with 12 additions and 1 deletions

View File

@ -26,3 +26,6 @@ SilverStripe\Forms\HTMLEditor\TinyMCEConfig:
SilverLeague\IDEAnnotator\DataObjectAnnotator:
enabled: true
SilverStripe\UserForms\Form\UserForm:
show_labels: false

View File

@ -2,6 +2,7 @@
namespace A2nt\CMSNiceties\Extensions;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\FieldList;
@ -31,9 +32,16 @@ class PlaceholderFormExtension extends Extension
'placeholder',
$placeholder
);
/*
* SilverStripe\UserForms\Form\UserForm:
* show_labels: false
*/
if (!Config::inst()->get(\get_class($this->owner), 'show_labels')) {
$field->setTitle('');
}
}
}
if (is_a($field, CompositeField::class)) {
$children = $field->getChildren();