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
|
if ($export instanceof ExportInterface) {
|
||||||
->getFormattersByTypes($export->getAllowedFormattersTypes());
|
$allowedFormatters = $this->exportManager
|
||||||
$choices = [];
|
->getFormattersByTypes($export->getAllowedFormattersTypes());
|
||||||
foreach (array_keys(iterator_to_array($allowedFormatters)) as $alias) {
|
$choices = [];
|
||||||
$choices[] = $alias;
|
foreach (array_keys(iterator_to_array($allowedFormatters)) as $alias) {
|
||||||
}
|
$choices[] = $alias;
|
||||||
|
}
|
||||||
|
|
||||||
$data[ExportType::PICK_FORMATTER_KEY]['alias'] = match (count($choices)) {
|
$data[ExportType::PICK_FORMATTER_KEY]['alias'] = match (count($choices)) {
|
||||||
1 => $choices[0],
|
1 => $choices[0],
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
unset($data[ExportType::PICK_FORMATTER_KEY]);
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,12 @@ class ExportManager
|
|||||||
*
|
*
|
||||||
* @return FilterInterface[] a \Generator that contains filters. The key is the filter's alias
|
* @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) {
|
foreach ($this->filters as $alias => $filter) {
|
||||||
if (
|
if (
|
||||||
in_array($filter->applyOn(), $export->supportsModifiers(), true)
|
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
|
* @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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user