Magento – Magento 2 cms page cms page Identifier

cmsmagento2

How to get cms page FullActionName()

$request->getFullActionName() == 'cms_index_index'

Now,i want to get cms pages identifier name at that cms page

In Magento 1, I used this Mage::getSingleton('cms/page')->getIdentifier() it will get all so that i want know what to do into Magento 2 ?

Best Answer

you can set condition in your block,
Here my block php file contains :

protected $_request;

public function __construct(
    ...
    \Magento\Framework\App\Request\Http $request,
    ...
) {
    ...
    $this->_request = $request;
    ...
}


public function isHomepage()
{

    if ($this->_request->getFullActionName() == 'cms_index_index') {
        return true;
    }
    return false;
}
Related Topic