I have a custom access check, but I don't wan't to just throw a "You are not authorized to view this page" error.

I wish to set a message "This functionality is only available for XXX".

Is there a way to do this rather than setting an error message accesing \Drupal::messenger() from the Access Check? (If this is not a recommended way)


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.