Skip to content

Commit

Permalink
Merge pull request #147 from dnna/removeinternalstate
Browse files Browse the repository at this point in the history
Do not use internal storage for export links
  • Loading branch information
lsmith77 authored Sep 10, 2018
2 parents 2655f1a + 648f8b4 commit 880f1f2
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Listener/ExportButtonGridListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ final class ExportButtonGridListener
*/
private $formats;

/**
* @var array[]
*/
private $links = [];

/**
* @param string[] $formats
*/
Expand Down Expand Up @@ -79,16 +74,15 @@ public function onSyliusGridAdmin(GridDefinitionConverterEvent $event)
*/
private function createLinks(): array
{
if (empty($this->links)) {
foreach ($this->formats as $format) {
$this->addLink($format);
}
$links = [];
foreach ($this->formats as $format) {
$links[] = $this->addLink($format);
}

return $this->links;
return $links;
}

private function addLink(string $format): void
private function addLink(string $format): array
{
$parameters = [
'resource' => $this->resource,
Expand All @@ -101,7 +95,7 @@ private function addLink(string $format): void
$parameters['criteria'] = $currentRequest->query->get('criteria');
}

$this->links[$format] = [
return [
'label' => 'fos.import_export.ui.types.' . $format,
'icon' => 'file archive',
'route' => 'app_export_data',
Expand Down

0 comments on commit 880f1f2

Please sign in to comment.