Magento2で現在のCMSページIDを取得しようとしています。以下は、Magento1.xで使用したコードですが、明らかに機能しなくなりました。しかし、Magento2でこれを行う方法を理解することができません。
if (Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') {
$_pageId = Mage::getBlockSingleton('cms/page')->getPage()->getPageId();
}
以下に示すレジストリを使用しても機能しません。
$this->_coreRegistry->registry('cms_page')->getId()