|
|
@@ -42,11 +42,6 @@ class IndividualDataFieldDefinition extends AbstractFieldDefinition |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
public function configurePanels(): array |
|
|
|
{ |
|
|
|
return []; |
|
|
|
} |
|
|
|
|
|
|
|
public function configureFields(): array |
|
|
|
{ |
|
|
|
$fields = array(); |
|
|
@@ -56,45 +51,35 @@ class IndividualDataFieldDefinition extends AbstractFieldDefinition |
|
|
|
$fields['email'] = EmailField::new('email'); |
|
|
|
$fields['territory'] = AssociationField::new('territory') |
|
|
|
->setTemplatePath('crud/field/association.html.twig'); |
|
|
|
$fields['nbDream'] = TextField::new('nbDream') |
|
|
|
->onlyOnIndex(); |
|
|
|
$fields['nbRevolt'] = TextField::new('nbRevolt') |
|
|
|
->onlyOnIndex(); |
|
|
|
$fields['nbProjectBoost'] = TextField::new('nbProjectBoost') |
|
|
|
->onlyOnIndex(); |
|
|
|
$fields['nbProjectInspiring'] = TextField::new('nbProjectInspiring') |
|
|
|
->onlyOnIndex(); |
|
|
|
$fields['nbDream'] = TextField::new('nbDream'); |
|
|
|
$fields['nbRevolt'] = TextField::new('nbRevolt'); |
|
|
|
$fields['nbProjectBoost'] = TextField::new('nbProjectBoost'); |
|
|
|
$fields['nbProjectInspiring'] = TextField::new('nbProjectInspiring'); |
|
|
|
$fields['revolt'] = CollectionField::new('revolt') |
|
|
|
->setFormTypeOption('entry_type', RevoltType::class) |
|
|
|
->setFormTypeOption('by_reference', false) |
|
|
|
->setRequired(false) |
|
|
|
->hideOnIndex(); |
|
|
|
->setRequired(false); |
|
|
|
$fields['dream'] = CollectionField::new('dream') |
|
|
|
->setFormTypeOption('entry_type', DreamType::class) |
|
|
|
->setFormTypeOption('by_reference', false) |
|
|
|
->setRequired(false) |
|
|
|
->hideOnIndex(); |
|
|
|
->setRequired(false); |
|
|
|
$fields['projectBoost'] = CollectionField::new('projectBoost') |
|
|
|
->setFormTypeOption('entry_type', ProjectBoostType::class) |
|
|
|
->setFormTypeOption('by_reference', false) |
|
|
|
->setRequired(false) |
|
|
|
->hideOnIndex(); |
|
|
|
->setRequired(false); |
|
|
|
$fields['projectinspiring'] = CollectionField::new('projectinspiring') |
|
|
|
->setFormTypeOption('entry_type', ProjectInspiringType::class) |
|
|
|
->setFormTypeOption('by_reference', false) |
|
|
|
->setRequired(false) |
|
|
|
->hideOnIndex(); |
|
|
|
->setRequired(false); |
|
|
|
$hasAccess = $this->authorizationChecker->isGranted('ROLE_ADMIN'); |
|
|
|
if ($hasAccess) { |
|
|
|
$fields['status'] = StatusField::new('status') |
|
|
|
->setFormTypeOption('data', 0) |
|
|
|
->setFormTypeOption('choices', ['Validé' => 1, 'En attente' => 0]) |
|
|
|
->setCustomOption('toggle_label', 'Valider') |
|
|
|
->hideOnIndex(); |
|
|
|
->setCustomOption('toggle_label', 'Valider'); |
|
|
|
} else { |
|
|
|
$fields['status'] = HiddenField::new('status') |
|
|
|
->setFormTypeOption('data', 0) |
|
|
|
->hideOnIndex(); |
|
|
|
->setFormTypeOption('data', 0); |
|
|
|
} |
|
|
|
|
|
|
|
|