Not sure if/how this will be possible, since in Drupal 8 at least when customerror/403 is used for access denied, the path shown and that Drupal seems to still use under the hood is admin/wherever/you-do-not-have-access, but it would be very useful to be able to have a block's visibility based on the custom error page.

This would make it easy to show the user login block only on access denied pages, for example.

While a bit similar to historical requests for menus/blocks to work (such as #267163: Left Navigation), this seems to be a different issue in Drupal 8. In any case, this is a request specifically for the ability to target block visibility based on the Custom error page specifically.

Comments

mlncn created an issue. See original summary.

mlncn’s picture

Just realized that since custom error pages are based on HTTP status code, what i really want is block visibility based on HTTP status code. That really should be in core, and was really hard to find in contrib, but here it is:

https://www.drupal.org/project/http_client_error_status

mlncn’s picture

I'm having a very strange problem with this setup:

My custom access denied page displays (beautifully, i might add) - https://agaric.coop/admin/

The Log In block also shows. So far, so good.

Using the log in block though results in the path changing to /customerror/403?destination=/admin — and the login not working.

Anyone have any thoughts?