The following code lets you determine the current page type (category, product, etc.) from a Magento 2 model:
|
1 |
$where = $this->request->getFullActionName(); |
The value of $where is, for example, catalog_product_viewwhen you are on a Magento product page.