Magento 2 – Get Current Page Layout

magento2page-layouts

I have Added Custom page layout in my store.
And set Test Category Page
But when I try to get my phtml file in category page

$request = $objectManager->get('Magento\Framework\App\Request\Http');
$layout = $request->getFullActionName();

It's catalog_category_view. I want there Test Category Page id which was I had set in Admin.

Best Answer

Page layout and handler are two different elements at Magento layout.

Page layout is 1column,2 columns-left,2 columns-right,cutome_home.

Where

handler is cms_index_index.xml,catalog_product_view,default,catalog_category_view etc

In Magento2, a page layout element can be managed using Layout handler .

At Magento, a unique handler created basically on Full Action Name every page.

If you trying at .phtml file

then use

$block->getLayout()->getUpdate()->getPageLayout()

At BLock class use

$this->getLayout()->getUpdate()->getPageLayout()

Related Topic