With D8, I have a node (content type: basic page) that I use as a custom 403 (access denied) page.
I set this as the custom 403 page on: /admin/config/system/site-information
. The path is /node/21
, and the alias is /error/403
.
On the block admin page, I added the user login block to the content region. I added the restriction "show only on certain pages":
- /error/*
- /view/*
- /node/21
I have a view that requires "add content type ABC permission" to access. The path to the view is /view/abc
. The anonymous user does NOT have this permission.
So, as an anonymous user, I go to /view/abc
and am shown the content of /node/21
. BUT, the user login block is not shown.
If I go to the block administration screen and remove the "show only on certain pages" restriction, then I see the block as the anonymous user on /view/abc
, but I don't want to show the login block on every single page; I only want to show it on the pages that are 403s.
What is the "path" to use for the user login block to only show it on a custom 403 page?
\Drupal::routeMatch()->getRouteName()
likesystem.403
to the admin page? Or thePathauto
orredirect
module? Or hook into these path elements? – Prestosaurus Jan 28 '19 at 19:27