forked from netgen-layouts/layouts-ibexa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override debug layout URL generator, in order to use admin siteaccess
- Loading branch information
Showing
4 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Netgen\Bundle\LayoutsEzPlatformBundle\Debug\DataCollector; | ||
|
||
use Netgen\Bundle\LayoutsDebugBundle\DataCollector\LayoutUrlGeneratorInterface; | ||
use Ramsey\Uuid\UuidInterface; | ||
|
||
final class LayoutUrlGenerator implements LayoutUrlGeneratorInterface | ||
{ | ||
private LayoutUrlGeneratorInterface $innerGenerator; | ||
|
||
/** | ||
* @var array<string, string[]> | ||
*/ | ||
private array $siteAccessGroups; | ||
|
||
/** | ||
* @param array<string, string[]> $siteAccessGroups | ||
*/ | ||
public function __construct( | ||
LayoutUrlGeneratorInterface $innerGenerator, | ||
array $siteAccessGroups, | ||
) { | ||
$this->innerGenerator = $innerGenerator; | ||
$this->siteAccessGroups = $siteAccessGroups; | ||
} | ||
|
||
public function generateLayoutUrl(UuidInterface $layoutId, array $parameters = []): string | ||
{ | ||
$adminSiteAccess = $this->siteAccessGroups['admin_group'][0] ?? 'admin'; | ||
|
||
return $this->innerGenerator->generateLayoutUrl($layoutId, ['siteaccess' => $adminSiteAccess]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
services: | ||
netgen_layouts.ezplatform.debug.data_collector.layout_url_generator: | ||
class: Netgen\Bundle\LayoutsEzPlatformBundle\Debug\DataCollector\LayoutUrlGenerator | ||
decorates: netgen_layouts.debug.data_collector.layout_url_generator | ||
arguments: | ||
- "@.inner" | ||
- "%ezpublish.siteaccess.groups%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters