mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix handling of DirectExportInterface
This commit is contained in:
parent
9978b6a6e4
commit
0e9597bf77
@ -72,17 +72,21 @@ final readonly class ExportFormHelper
|
||||
];
|
||||
}
|
||||
|
||||
$allowedFormatters = $this->exportManager
|
||||
->getFormattersByTypes($export->getAllowedFormattersTypes());
|
||||
$choices = [];
|
||||
foreach (array_keys(iterator_to_array($allowedFormatters)) as $alias) {
|
||||
$choices[] = $alias;
|
||||
}
|
||||
if ($export instanceof ExportInterface) {
|
||||
$allowedFormatters = $this->exportManager
|
||||
->getFormattersByTypes($export->getAllowedFormattersTypes());
|
||||
$choices = [];
|
||||
foreach (array_keys(iterator_to_array($allowedFormatters)) as $alias) {
|
||||
$choices[] = $alias;
|
||||
}
|
||||
|
||||
$data[ExportType::PICK_FORMATTER_KEY]['alias'] = match (count($choices)) {
|
||||
1 => $choices[0],
|
||||
default => null,
|
||||
};
|
||||
$data[ExportType::PICK_FORMATTER_KEY]['alias'] = match (count($choices)) {
|
||||
1 => $choices[0],
|
||||
default => null,
|
||||
};
|
||||
} else {
|
||||
unset($data[ExportType::PICK_FORMATTER_KEY]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -113,8 +113,12 @@ class ExportManager
|
||||
*
|
||||
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
|
||||
*/
|
||||
public function &getFiltersApplyingOn(ExportInterface $export, ?array $centers = null)
|
||||
public function &getFiltersApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): iterable
|
||||
{
|
||||
if ($export instanceof DirectExportInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->filters as $alias => $filter) {
|
||||
if (
|
||||
in_array($filter->applyOn(), $export->supportsModifiers(), true)
|
||||
@ -132,9 +136,9 @@ class ExportManager
|
||||
*
|
||||
* @return null|iterable<string, AggregatorInterface> a \Generator that contains aggretagors. The key is the filter's alias
|
||||
*/
|
||||
public function &getAggregatorsApplyingOn(ExportInterface $export, ?array $centers = null): ?iterable
|
||||
public function &getAggregatorsApplyingOn(ExportInterface|DirectExportInterface $export, ?array $centers = null): ?iterable
|
||||
{
|
||||
if ($export instanceof ListInterface) {
|
||||
if ($export instanceof ListInterface || $export instanceof DirectExportInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user