diff --git a/bundle/Debug/DataCollector/LayoutUrlGenerator.php b/bundle/Debug/DataCollector/LayoutUrlGenerator.php new file mode 100644 index 00000000..8266ea29 --- /dev/null +++ b/bundle/Debug/DataCollector/LayoutUrlGenerator.php @@ -0,0 +1,27 @@ + $siteAccessGroups + */ + public function __construct( + private LayoutUrlGeneratorInterface $innerGenerator, + private array $siteAccessGroups, + ) { + } + + public function generateLayoutUrl(UuidInterface $layoutId, array $parameters = []): string + { + $adminSiteAccess = $this->siteAccessGroups['admin_group'][0] ?? 'admin'; + + return $this->innerGenerator->generateLayoutUrl($layoutId, ['siteaccess' => $adminSiteAccess]); + } +} diff --git a/bundle/DependencyInjection/NetgenLayoutsIbexaExtension.php b/bundle/DependencyInjection/NetgenLayoutsIbexaExtension.php index ce7c7217..e2472ce0 100644 --- a/bundle/DependencyInjection/NetgenLayoutsIbexaExtension.php +++ b/bundle/DependencyInjection/NetgenLayoutsIbexaExtension.php @@ -55,6 +55,10 @@ public function load(array $configs, ContainerBuilder $container): void if (array_key_exists('NetgenTagsBundle', $activatedBundles)) { $loader->load('netgen_tags/services.yaml'); } + + if (array_key_exists('NetgenLayoutsDebugBundle', $activatedBundles)) { + $loader->load('debug/services.yaml'); + } } public function prepend(ContainerBuilder $container): void diff --git a/bundle/Resources/config/debug/services.yaml b/bundle/Resources/config/debug/services.yaml new file mode 100644 index 00000000..54a507cb --- /dev/null +++ b/bundle/Resources/config/debug/services.yaml @@ -0,0 +1,7 @@ +services: + netgen_layouts.ibexa.debug.data_collector.layout_url_generator: + class: Netgen\Bundle\LayoutsIbexaBundle\Debug\DataCollector\LayoutUrlGenerator + decorates: netgen_layouts.debug.data_collector.layout_url_generator + arguments: + - "@.inner" + - "%ibexa.site_access.groups%" diff --git a/composer.json b/composer.json index c58d05e6..92813caa 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "php": "^8.1", - "netgen/layouts-core": "~1.4.6", + "netgen/layouts-core": "~1.4.9", "netgen/content-browser-ibexa": "^1.4", "ibexa/core": "^4.4", "ibexa/admin-ui": "^4.4",