Skip to content

Commit 5ed0091

Browse files
committed
Merge remote-tracking branch 'origin/MC-34254' into 2.4-develop-pr75
2 parents 6d15bb1 + 9fe744f commit 5ed0091

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/internal/Magento/Framework/View/Page/Builder.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
namespace Magento\Framework\View\Page;
77

88
use Magento\Framework\App;
9+
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\Event;
1011
use Magento\Framework\View;
12+
use Magento\Framework\View\Model\PageLayout\Config\BuilderInterface;
1113

1214
/**
1315
* Class Builder
@@ -24,24 +26,32 @@ class Builder extends View\Layout\Builder
2426
*/
2527
protected $pageLayoutReader;
2628

29+
/**
30+
* @var BuilderInterface|mixed
31+
*/
32+
private $pageLayoutBuilder;
33+
2734
/**
2835
* @param View\LayoutInterface $layout
2936
* @param App\Request\Http $request
3037
* @param Event\ManagerInterface $eventManager
3138
* @param Config $pageConfig
3239
* @param Layout\Reader $pageLayoutReader
40+
* @param BuilderInterface|null $pageLayoutBuilder
3341
*/
3442
public function __construct(
3543
View\LayoutInterface $layout,
3644
App\Request\Http $request,
3745
Event\ManagerInterface $eventManager,
3846
Config $pageConfig,
39-
Layout\Reader $pageLayoutReader
47+
Layout\Reader $pageLayoutReader,
48+
?BuilderInterface $pageLayoutBuilder = null
4049
) {
4150
parent::__construct($layout, $request, $eventManager);
4251
$this->pageConfig = $pageConfig;
4352
$this->pageLayoutReader = $pageLayoutReader;
4453
$this->pageConfig->setBuilder($this);
54+
$this->pageLayoutBuilder = $pageLayoutBuilder ?? ObjectManager::getInstance()->get(BuilderInterface::class);
4555
}
4656

4757
/**
@@ -73,6 +83,10 @@ protected function readPageLayout()
7383
*/
7484
protected function getPageLayout()
7585
{
76-
return $this->pageConfig->getPageLayout() ?: $this->layout->getUpdate()->getPageLayout();
86+
$pageLayout = $this->pageConfig->getPageLayout();
87+
88+
return ($pageLayout && $this->pageLayoutBuilder->getPageLayoutsConfig()->hasPageLayout($pageLayout))
89+
? $pageLayout
90+
: $this->layout->getUpdate()->getPageLayout();
7791
}
7892
}

0 commit comments

Comments
 (0)