Skip to content

Commit 9b8d50d

Browse files
committed
Tag IbexaPageView response with Layouts tags
1 parent 53f9588 commit 9b8d50d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

bundle/Controller/IbexaPageView.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Netgen\Bundle\IbexaSiteApiBundle\Controller\Controller as BaseController;
88
use Netgen\Bundle\IbexaSiteApiBundle\View\ContentView;
9+
use Netgen\Layouts\HttpCache\TaggerInterface;
910
use Netgen\Layouts\Layout\Resolver\LayoutResolverInterface;
1011
use Netgen\OpenApiIbexa\Page\Output\OutputVisitor;
1112
use Netgen\OpenApiIbexa\Page\PageFactory;
@@ -23,6 +24,7 @@ public function __construct(
2324
private LayoutResolverInterface $layoutResolver,
2425
private PageFactory $pageFactory,
2526
private OutputVisitor $outputVisitor,
27+
private TaggerInterface $layoutsTagger,
2628
) {}
2729

2830
public function __invoke(ContentView $view): JsonResponse
@@ -31,6 +33,11 @@ public function __invoke(ContentView $view): JsonResponse
3133
$queryDefinitionCollection = $view->getParameter(ContentView::QUERY_DEFINITION_COLLECTION_NAME);
3234

3335
$rule = $this->layoutResolver->resolveRule();
36+
$layout = $rule?->getLayout();
37+
38+
if ($layout !== null) {
39+
$this->layoutsTagger->tagLayout($layout);
40+
}
3441

3542
$data = $this->outputVisitor->visit(
3643
$this->pageFactory->buildPage($view->getSiteContent(), $view->getSiteLocation(), $queryDefinitionCollection, $rule?->getLayout()),

bundle/Resources/config/services/controllers.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
- '@netgen_layouts.layout.resolver'
3636
- '@netgen.openapi_ibexa.page.factory'
3737
- '@netgen.openapi_ibexa.page.output.visitor.output_visitor'
38+
- '@netgen_layouts.http_cache.tagger'
3839
public: true
3940
tags:
4041
- { name: container.service_subscriber }

0 commit comments

Comments
 (0)