4

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.

1 Answer 1

2

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()

3
  • 1
    So, How can I get Page layout 'cutome_home' ID? May 30, 2018 at 9:50
  • I want to put there condition if it is 'Test Category Page' layout May 30, 2018 at 9:59
  • This only shows 1column even though I manually changed the page layout to a custom page layout which inherits from 1column
    – Black
    Apr 22, 2021 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.