mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
exports: display group as a breadcrumb in template
add a private method in controller which could be moved maybe in ExportManager
This commit is contained in:
@@ -86,6 +86,9 @@ class ExportController extends AbstractController
|
||||
{
|
||||
/** @var \Chill\MainBundle\Export\ExportManager $exportManager */
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$export = $exportManager->getExport($alias);
|
||||
|
||||
$key = $request->query->get('key', null);
|
||||
|
||||
[$dataCenters, $dataExport, $dataFormatter] = $this->rebuildData($key);
|
||||
@@ -100,7 +103,8 @@ class ExportController extends AbstractController
|
||||
|
||||
$viewVariables = [
|
||||
'alias' => $alias,
|
||||
'export' => $exportManager->getExport($alias),
|
||||
'export' => $export,
|
||||
'export_group' => $this->getExportGroup($export),
|
||||
];
|
||||
|
||||
if ($formater instanceof \Chill\MainBundle\Export\Formatter\CSVListFormatter) {
|
||||
@@ -316,6 +320,7 @@ class ExportController extends AbstractController
|
||||
'form' => $form->createView(),
|
||||
'export_alias' => $alias,
|
||||
'export' => $export,
|
||||
'export_group' => $this->getExportGroup($export),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -371,6 +376,7 @@ class ExportController extends AbstractController
|
||||
[
|
||||
'form' => $form->createView(),
|
||||
'export' => $export,
|
||||
'export_group' => $this->getExportGroup($export),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -514,6 +520,7 @@ class ExportController extends AbstractController
|
||||
[
|
||||
'form' => $form->createView(),
|
||||
'export' => $export,
|
||||
'export_group' => $this->getExportGroup($export),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -565,4 +572,19 @@ class ExportController extends AbstractController
|
||||
throw new LogicException("the step {$step} is not defined.");
|
||||
}
|
||||
}
|
||||
|
||||
private function getExportGroup($target): string
|
||||
{
|
||||
$exportManager = $this->exportManager;
|
||||
|
||||
$groups = $exportManager->getExportsGrouped(true);
|
||||
|
||||
foreach ($groups as $group => $array) {
|
||||
foreach ($array as $alias => $export) {
|
||||
if ($export === $target) {
|
||||
return $group;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user