contactsConfig = $contactsConfig; } /** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface * @throws \Magento\Framework\Exception\NotFoundException */ public function dispatch(RequestInterface $request) { if (!$this->contactsConfig->isEnabled()) { throw new NotFoundException(__('Page not found.')); } return parent::dispatch($request); } }