Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Model/Component/Resolver/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ public function construct(AbstractBlock $block): Component
public function reconstruct(RequestInterface $request): Component
{
$page = $this->resultPageFactory->create();
if ($request->getFingerprint('layout')) {
$page->getConfig()->setPageLayout(strtolower($request->getFingerprint('layout')));
}
$page->addHandle(strtolower($request->getFingerprint('handle')))->initLayout();

/**
Expand Down
7 changes: 6 additions & 1 deletion src/Model/ComponentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Locale\Resolver;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Page\Config;
use Magewirephp\Magewire\Exception\AcceptableException;
use Magewirephp\Magewire\Component;
use Magewirephp\Magewire\Exception\ComponentHydrationException;
Expand All @@ -21,19 +22,22 @@ class ComponentManager
{
protected Resolver $localeResolver;
protected HttpFactory $httpFactory;
protected Config $pageConfig;
protected array $updateActionsPool;
protected array $hydrationPool;

public function __construct(
HydratorContext $hydratorContext,
Resolver $localeResolver,
HttpFactory $httpFactory,
Config $pageConfig,
array $updateActionsPool = [],
array $hydrationPool = []
) {
$this->localeResolver = $localeResolver;
$this->updateActionsPool = $updateActionsPool;
$this->httpFactory = $httpFactory;
$this->pageConfig = $pageConfig;

// Core Hydrate & Dehydrate lifecycle sort order.
$this->hydrationPool = $this->sortHydrators($hydrationPool, [
Expand Down Expand Up @@ -153,7 +157,8 @@ public function createInitialRequest(

// Custom relative to Livewire's core.
'handle' => $handle ?? $request->getFullActionName(),
'type' => $component::COMPONENT_TYPE
'type' => $component::COMPONENT_TYPE,
'layout' => $this->pageConfig->getPageLayout()
],

'serverMemo' => [
Expand Down