Skip to content

Instantly share code, notes, and snippets.

@jcastellanos926
Last active September 24, 2020 11:06
Show Gist options
  • Save jcastellanos926/29ac4933a92e986705bc135911e77027 to your computer and use it in GitHub Desktop.
Save jcastellanos926/29ac4933a92e986705bc135911e77027 to your computer and use it in GitHub Desktop.
M2: Get Handles

Print Magento 2 handles (Just for testing purposes)

protected $resultPageFactory;

public function __construct(
    Context $context,
    \Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
    $this->resultPageFactory = $resultPageFactory;
    parent::__construct($context);
}

public function execute()
{
    $resultPage = $this->resultPageFactory->create();
     die(print_r($resultPage->getLayout()->getUpdate()->getHandles()));
     return $resultPage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment