mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 02:53:50 +00:00
ChillPersonBundle: Add numberOfDependents and numberOfDependentsWithDisabilities
This commit is contained in:
@@ -19,10 +19,19 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
|
||||
class HouseholdCompositionType extends AbstractType
|
||||
{
|
||||
public function __construct(private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {}
|
||||
private array $fields_visibility;
|
||||
|
||||
public function __construct(
|
||||
private readonly HouseholdCompositionTypeRepository $householdCompositionTypeRepository,
|
||||
private readonly TranslatableStringHelperInterface $translatableStringHelper,
|
||||
protected ParameterBagInterface $parameterBag,
|
||||
) {
|
||||
$this->fields_visibility = $parameterBag->get('chill_person.person_fields');
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
@@ -42,7 +51,19 @@ class HouseholdCompositionType extends AbstractType
|
||||
->add('numberOfChildren', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfChildren',
|
||||
])
|
||||
]);
|
||||
if ('visible' == $this->fields_visibility['number_of_dependents']) {
|
||||
$builder
|
||||
->add('numberOfDependents', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfDependents',
|
||||
])
|
||||
->add('numberOfDependentsWithDisabilities', IntegerType::class, [
|
||||
'required' => true,
|
||||
'label' => 'household_composition.numberOfDependentsWithDisabilities',
|
||||
]);
|
||||
}
|
||||
$builder
|
||||
->add('comment', CommentType::class, [
|
||||
'required' => false,
|
||||
]);
|
||||
|
Reference in New Issue
Block a user