I need to throw 404 error in module. Or may be there are any possibility to set required option for menu hook?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is easy. These should take care of watchdog, HTTP 404 response code and other related things.
For Drupal 6 & 7
In your module’s page callback, do:
return drupal_not_found();For Drupal 8
In the
class::method()referred to in the_controllerdefinition (i.e. the page callback or the method responsible for generating output for the request), do:throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();References