fix missing choices in getFormDefaultData with automatic generation

This commit is contained in:
Julien Fastré 2023-06-05 18:16:32 +02:00
parent 7fab411b96
commit cf576dca7b
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 15 additions and 0 deletions

View File

@ -86,6 +86,11 @@ class CSVFormatter implements FormatterInterface
} }
} }
public function getFormDefaultData(array $aggregatorAliases): array
{
return [];
}
public function gatherFiltersDescriptions() public function gatherFiltersDescriptions()
{ {
$descriptions = []; $descriptions = [];

View File

@ -118,6 +118,14 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface, Grou
} }
public function getFormDefaultData(): array public function getFormDefaultData(): array
{ {
$choices = array_combine(ListPersonHelper::FIELDS, ListPersonHelper::FIELDS);
foreach ($this->getCustomFields() as $cf) {
$choices[$this->translatableStringHelper->localize($cf->getName())]
=
$cf->getSlug();
}
return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()]; return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()];
} }

View File

@ -91,6 +91,8 @@ class ListPersonWithAccompanyingPeriod implements ExportElementValidatedInterfac
} }
public function getFormDefaultData(): array public function getFormDefaultData(): array
{ {
$choices = array_combine(ListPersonHelper::FIELDS, ListPersonHelper::FIELDS);
return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()]; return ['fields' => array_values($choices), 'address_date' => new DateTimeImmutable()];
} }