diff --git a/src/Form/AbstractSettingsExtension.php b/src/Form/AbstractSettingsExtension.php index a444635a..5c66a752 100644 --- a/src/Form/AbstractSettingsExtension.php +++ b/src/Form/AbstractSettingsExtension.php @@ -35,6 +35,16 @@ public function addWithDefaultCheckbox(FormBuilderInterface $builder, string $ch return $this; } + public function removeWithDefaultCheckbox(FormBuilderInterface $builder, string $child): self + { + $builder->remove($child); + if (!$this->isDefaultForm($builder)) { + $builder->remove($child . '___' . Settings::DEFAULT_KEY); + } + + return $this; + } + protected function isDefaultForm(FormBuilderInterface $builder): bool { return !$builder->getOption('show_default_checkboxes', true);