Skip to content

Commit

Permalink
feat: Improved AbstractExplorerItem and AbstractExplorerItem
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Sep 1, 2022
1 parent b8f344d commit 66386d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/Explorer/AbstractDoctrineExplorerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use RZ\Roadiz\CoreBundle\ListManager\EntityListManagerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

/**
* @package Themes\Rozier\Explorer
Expand All @@ -17,15 +18,16 @@ abstract class AbstractDoctrineExplorerProvider extends AbstractExplorerProvider
{
protected ManagerRegistry $managerRegistry;
protected RequestStack $requestStack;
protected UrlGeneratorInterface $urlGenerator;

/**
* @param ManagerRegistry $managerRegistry
* @param RequestStack $requestStack
*/
public function __construct(ManagerRegistry $managerRegistry, RequestStack $requestStack)
{
public function __construct(
ManagerRegistry $managerRegistry,
RequestStack $requestStack,
UrlGeneratorInterface $urlGenerator
) {
$this->managerRegistry = $managerRegistry;
$this->requestStack = $requestStack;
$this->urlGenerator = $urlGenerator;
}

/**
Expand Down
14 changes: 12 additions & 2 deletions src/Explorer/AbstractExplorerItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

abstract class AbstractExplorerItem implements ExplorerItemInterface
{
protected function getEditItemPath(): ?string
{
return null;
}

protected function getThumbnail(): ?array
{
return null;
}

/**
* @inheritDoc
*/
Expand All @@ -15,8 +25,8 @@ public function toArray(): array
'id' => $this->getId(),
'classname' => $this->getAlternativeDisplayable() ?? '',
'displayable' => $this->getDisplayable(),
'editItem' => null,
'thumbnail' => null
'editItem' => $this->getEditItemPath(),
'thumbnail' => $this->getThumbnail()
];
}
}

0 comments on commit 66386d6

Please sign in to comment.