2

I am looking to do one of these solutions for a users 'contact' page. When a user has unchecked "Personal Contact Form", and someone accesses that URL (user/id/contact), the breadcrumb displays the users username in the breadcrumb.

The username in the breadcrumb is not desirable, because some people make their email address their username, so:

  • How can I disable the breadcrumb from displaying on 403/404 responses, or
  • How can I disable the path based breadcrumb service outright?
3
  • How can I disable the path based breadcrumb service outright? override the service with empty, I guess.
    – No Sssweat
    Apr 20, 2018 at 18:23
  • That's valid? Won't cause any errors?
    – Kevin
    Apr 20, 2018 at 18:26
  • Possibly... well... there is one way to find out, haha.
    – No Sssweat
    Apr 20, 2018 at 18:34

1 Answer 1

5

You could add a visibility condition to the breadcrumb block. For 404 there is this module block_in_page_not_found and if you negate the condition the block is displayed on all pages other than 404's:

enter image description here

If you want to exclude 403 pages as well you can extend this module and add a check for

$status->getStatusCode() == 403

to Drupal\block_in_page_not_found\Plugin\Condition\PageNotFoundRequest::evaluate.

Or use the patch from this issue Allow blocks to be configured to show/hide on 403/404 pages, when it applies again.

2
  • Ah, I suppose I could do this too, that didn’t even occur to me.
    – Kevin
    Apr 21, 2018 at 17:37
  • Following their example I made a small module condition that checked 403.
    – Kevin
    Apr 23, 2018 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.