Skip to content

Commit 5b4cbb5

Browse files
committed
Add pageHandles to AJAX calls
1 parent aef30dd commit 5b4cbb5

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Controller/Index/Html.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function execute(): ResultInterface|ResponseInterface
5656
{
5757
$data = $this->requestDataLoader->load();
5858
$this->requestDataLoader->mergeRequestParams();
59-
$layout = $this->layoutLoader->load($data['handles'], [], true);
59+
$layout = $this->layoutLoader->load($data['handles'], $data['pageHandles'], true);
6060

6161
$updates = $this->getComponentUpdates($data['updates'], $layout);
6262
$updates = $this->sortUpdates($updates);
@@ -72,6 +72,7 @@ public function execute(): ResultInterface|ResponseInterface
7272
);
7373
} catch (NoBlockFoundException $exception) {
7474
$this->logger->critical($exception);
75+
$this->addExceptionMessage($exception);
7576

7677
} catch (RedirectException $redirectException) {
7778
return $this->getJsonRedirect($redirectException);

Util/ComponentUtil.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public function getHandles(AbstractBlock $block): array
4242
return $block->getLayout()->getUpdate()->getHandles();
4343
}
4444

45+
public function getPageHandles(AbstractBlock $block): array
46+
{
47+
return [$block->getLayout()->getUpdate()->getPageLayout()];
48+
}
49+
4550
public function getRequestData(): array
4651
{
4752
/** @var Http $request */

view/base/templates/script/ajax-queue.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ if ($interval < 10) {
165165
handles: <?= /* @noEscape */ json_encode(
166166
$componentUtil->getHandles($block)
167167
) ?>,
168+
pageHandles: <?= /* @noEscape */ json_encode(
169+
$componentUtil->getPageHandles($block)
170+
) ?>,
168171
request: <?= /* @noEscape */ json_encode(
169172
$componentUtil->getRequestData()
170173
) ?>

0 commit comments

Comments
 (0)