Problem/Motivation
In #2987964: Move custom block types admin link to admin/structure, we moved the "Custom block types" page from /admin/structure/block/block-content/types to /admin/structure/block-content. This change will be disruptive for any links to the old path. That includes links outside of Drupal such as browser bookmarks and may also include links from the Shortcut module.
Steps to reproduce
- Install Drupal 10.0 with the Standard profile.
- Navigate to
/admin/structure/block/block-content/types. - Add a shortcut to this page. (Use the link with a star icon next to the page title.)
- Upgrade to 10.1.x.
- Use the "Custom block library" shortcut.
The last step gives a 404 (Page not found) response:

Proposed resolution
- Add a new route that will redirect from
/admin/structure/block/block-content/typesto/admin/structure/block-content. - Generate a warning message. The message is shown to the user.
- Log a warning message (same level as Page not found).
- Trigger a deprecation warning when using the redirect.
The warning message in (2) is
You have been redirected from /admin/structure/block/block-content/types. Update links, shortcuts, and bookmarks to use the current page.
The log message in (3) is (for a multilingual site)
A user was redirected from /es/admin/structure/block/block-content/types to /es/admin/structure/block-content. This redirect will be removed in a future version of Drupal. Update links, shortcuts, and bookmarks to use /es/admin/structure/block-content. See https://www.drupal.org/node/3320855 for more information.
Remaining tasks
Decide whether to show a message in the UI as well as triggering a deprecation and logging a warning.- Document our decisions on #3333394: [policy, no patch] Determine a best practice for providing BC for internal paths that change between minor releases.
Review the message text.
User interface changes
Message to user (with language code on a multilingual site).

API changes
None
Data model changes
None
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #52 | Screenshot from 2023-02-06 10-41-58.png | 417.89 KB | larowlan |
| #45 | Screen Shot 2023-01-31 at 11.32.00 am.png | 104.44 KB | acbramley |
| #36 | Screenshot from 2023-01-27 19-19-08.png | 52.88 KB | benjifisher |
| #36 | Screenshot from 2023-01-27 19-09-46.png | 49.65 KB | benjifisher |
| #29 | Screenshot from 2023-01-22 16-10-08.png | 71.98 KB | benjifisher |
Issue fork drupal-3333383
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3333383-redirect-block-types
changes, plain diff MR !3244
Comments
Comment #2
benjifisherWe discussed this problem on #2862564: Move Custom block library to Content, which is related to #2987964: Move custom block types admin link to admin/structure. We agreed to postpone #2862564 on this issue, and we may revert #2987964 if we cannot fix this issue before Drupal 10.1.0-alpha1. See Comments #120, #121, #124, #127, #130, #131 on Issue #2862564. I added both as related issues.
We suggested
entity.block_content.collection.bcas the new route name.We suggested escalating the warning message to an error in Drupal 11 and removing the route in Drupal 12. I added #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name as a related issue: if that issue is fixed, then we should follow the procedure there for deprecating a route before removing it.
Comment #4
benjifisherI think this issue is properly a bug report, not a task.
MR !3244 implements the proposed resolution.
I included a test for the deprecation message. Should I also include a test for the warning message?
Comment #5
benjifisherI forgot to unassign myself when I set the status to NR.
I am queueing a re-test.
Comment #6
catchThought about the @trigger_error plus explicit log message, and that makes sense to me - allows us to have one message mainly for tests and one mainly for site admins.
I think this is a good approach.
Comment #7
benjifisherI am adding #3333394: [policy, no patch] Determine a best practice for providing BC for internal paths that change between minor releases as a related issue. We can document there what we decide to do on this issue.
The static analysis tools insist on a specific version in the deprecation message, and I targeted
drupal:12.0.0. That is based on my suggestion from #2862564-124: Move Custom block library to Content:Maybe that is overly complicated. A 404 response (page not found) is logged as a warning, so it is odd to issue an error for the redirect. Perhaps we can agree to delete the route in Drupal 11, without first deprecating it (process for that to be decided in #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name). Are these steps enough to delete a route without first deprecating it?
.routing.ymlfile saying when it will be removed.Comment #8
smustgrave commentedChanges look good to me.
Comment #9
larowlanOne question about whether we want to surface this to users to via the messenger, thanks for the quick turnaround
Comment #10
xjmI agree that we should log messages in watchdog, since users and not developers might need to be the ones to make the change. The question is what severity to log them at. Warning?
Comment #11
aaronmchaleI would suggest following the same pattern that we use for 404. We're essentially saying "hey, this page no longer exists, it's now over here".
Comment #12
xjmThat's a good suggestion @AaronMcHale. NW for that.
Comment #13
benjifisherThe current MR already logs warnings, so back to NR:
I think the remaining question is related: when do we remove the BC route, in D11 or D12? My original suggestion was to escalate the warning to an error in D11 and then remove the route in D12. I am having second thoughts: see Comment #7.
There is also room for some wordsmithing.
Comment #14
aaronmchaleMy first thought would be, is there existing precedent to keep the redirect beyond the next major version? In general we remove BC-layers in each major version, so since it sounds like we're considering this a BC-layer, then to me it seems logical that we would remove it in D11.
Comment #15
xjmMaybe I misunderstood @larowlan's comment? I think it should definitely log it to the user; even though there is a redirect, it's a "You are doing it wrong" redirect that will stop working in a few years. 301, not 302.
Comment #16
xjm@AaronMcHale re:
We have a precedent of deprecating two major versions ahead when something is too disruptive to do for the next major version; plenty of things in 9.5.x are deprecated for removal in 11.0.0:
Edit: We also have a precedent of staging changes so that a non-disruptive version happens in a minor, the moderately disruptive version happens in the next major, and the very disruptive version happens in the major after the next.
Comment #17
larowlanYeah I was asking for ->messenger()->addWarning() so it shows in the UI
Comment #18
xjmWe could do that in D11. I think it's pretty bad UX to show that message, so we should start out with the logger/deprecation only for 10.1 IMO.
Comment #19
xjmI realized while discussing this with @larowlan that I was trying to come up with a generic pattern that we could use for any deprecated path, but in this case it's a site administrator's path, so maybe we don't need to be as cautious re: warnings as if it were end-user-facing. If it were end-user-facing, I think we would want to warn in the next major and deprecate in the after-next. But maybe we can warn the user in a minor for an admin path.
Comment #20
catchYeah I think for this issue (and the other blocks one), we can be pretty confident that the person who reads any message will be in a position to update either toolbar shortcuts, or browser bookmarks, or whatever else led them there, so being noisy in Drupal 10 and removing the bc in Drupal 11 seems fine. But we might want to adopt the two-major approach for site visitor-facing paths if/when we try to move one of those.
Comment #21
benjifisherI think we have consensus on removing the BC route in Drupal 11, even if we do not deprecate it first. Updating the version in the deprecation messages will be pretty easy.
In fact, I just did it. Now I do not have to apologize for leaving this issue at NR.
Do we have consensus on whether to use the messenger service?
Comment #22
xjmWe should use the messenger service and display a warning to the user upon redirect, yes. The answer would be different if the path did not currently require a restricted access permission, though. If it were available to content authors or especially end users, we would use the three-major approach of log+deprecate in a minor, warn in a major, and remove in the following major.
Comment #23
smustgrave commentedSo is all that’s missing is a message displayed
Comment #24
smustgrave commentedOkay added a message. ready for review.
Comment #25
xjmLet's add screenshots of the warning message, then get a usability review to help come up with the appropriate text.
Comment #26
smustgrave commentedUpdated feedback and added screenshot.
NR for usability check.
Comment #27
benjifisher@smustgrave: Thanks for adding the message. I was planning to do that after I saw #22, but you got to it first.
We will remove the BC route before Drupal 11, not as part of #3333394: [policy, no patch] Determine a best practice for providing BC for internal paths that change between minor releases, so I updated the comment in the
.routing.ymlfile. I made the comment a deprecation notice and a reference to the CR.My thinking is that I want to make it easy to remove the BC route when we are preparing for D11. I assume that we do that by searching for deprecation notices. The MR already adds a deprecation notice to the controller, and we might know to remove the route when we remove the controller. I think it is more reliable to add a separate deprecation comment.
I reviewed the comments and patch from #3159210: Support route aliasing (Symfony 5.4) and allow deprecating the route name, and I searched for "deprecat" on the Symfony docs https://symfony.com/doc/current/routing.html. I considered adding a
deprecated:section to the BC route, but it looks as though that is specifically intended for route aliases (changing the route name) so I decided not to.I am updating the issue summary now, and I will update the change record next.
Comment #28
benjifisherI took @xjm's suggestions for the comment in the routing file and for the message text, except
@seethe change record for this issue instead of #3333394: [policy, no patch] Determine a best practice for providing BC for internal paths that change between minor releases.I am setting the status to NW to review the message text and update the screenshot. I will add the current message text to the issue summary.
Comment #29
benjifisherI am updating the screenshot in the issue description. My local site is running 10.1.x with the Umami demo profile (Claro theme).
While reviewing the message text, we should consider that the title of the page also changed. When it was a sub-tab on the "Custom block library" page, the page title was "Custom block library" and the sub-tab title was "Block types". Now there are no tabs (local tasks) involved, and the page title is "Custom block types".
Comment #30
smustgrave commentedAlso soon to be renamed to Block types
Comment #31
smustgrave commentedSo is the only blocker on this the wording?
Comment #32
aaronmchaleI realise I'm a bit late to the party here, but @xjm in #16: Thanks for the info there!
I also agree with the thinking that since this is an admin facing path, removing in D11 is fine, and that if it were more user-facing then a longer window for removal makes sense.
Comment #33
aaronmchaleDid not mean to change the status.
Comment #34
benjifisherUsability review
We discussed this issue at #3335028: Drupal Usability Meeting 2023-01-27. That issue will have a link to a recording of the meeting.
For the record, the attendees at today's usability meeting were @BlackBamboo, @benjifisher, @ckrina, @iszabo, @shaal, and @simohell.
We agreed that there are some problems with the current text:
In order to keep the message short, we agreed that it is not important to explain that the redirect will be removed in a later version. We suggest the following:
We could make it even shorter: leave off the current path and let the user get it from the browser. Or provide a link:
A full URL will be more useful for external bookmarks, and providing the link will help if the browser hides the current URL. This message explains the situation and how to fix it. The only thing missing, for brevity, is the urgency (fix it before D11).
We should be able to get the legacy path (with language code, if the site is multilingual) from the BC route. We should update the MR and the issue description (text and screenshot).
Comment #35
smustgrave commentedUpdated message to first suggestion.
Comment #36
benjifisherI am addressing @AaronMcHale's comment from the MR.
I am also updating the issue summary and attaching new screenshots:
Standard profile (one language):
Umami demo profile (multilingual):
Finally, I am logging a different message from the one shown to the user. The log message includes the note about removing the redirect, and it refers to the change record. I am pretty sure that log messages are not supposed to be translated.
Comment #37
smustgrave commentedWoo. As soon as this gets committed I'll update the block library ticket so we can unblock the 3 behind that.
Comment #38
benjifisherThe test passes locally:
I queued a retest, but I am not optimistic.
Comment #39
smustgrave commentedAlso ran the tests locally between marking RTBC. Could it be an issue with the link (current page)
Comment #40
aaronmchaleCommented in GitLab.
Comment #41
smustgrave commentedUpdated to this page.
Comment #42
benjifisherI think the test should use an explicit path:
Since @smustgrave and I have both worked on the MR, neither of us should set the issue status to RTBC. I am setting it back to NR. Besides, we have to come to an agreement on "this page" vs. "the current page".
Comment #43
benjifisherWe looked at this issue in #3335028: Drupal Usability Meeting 2023-01-27. (See Comment #34.) I am removing the tag for a usability review.
Comment #44
aaronmchaleCommented in GitLab.
Comment #45
acbramley commentedRead through the comments and it looks like all feedback has been addressed, also manually tested and updated the screenshot in the IS with the new messaging.
Marking RTBC :)
Comment #46
aaronmchaleLeft a comment on the MR again.
I'm happy to second RTBC status. I'm also mindful the sooner this lands the sooner we can get #2862564: Move Custom block library to Content done.
Comment #47
smustgrave commentedYes this has turned into a blocker for a number of tickets now.
Comment #48
larowlanI think we're using FormattableMarkup wrong.
I also opened #3339400: Incorrect use of FormattableMarkup in logger messages for another incorrect usage I found in core
Comment #49
smustgrave commentedReplaced with t()
Comment #50
larowlanI don't think we want that either, I'm not seeing logger messages translated in core. Happy to be wrong on that.
Comment #51
smustgrave commentedSo just a regular string then?
Comment #52
larowlanYeah, here's some examples from core
Comment #53
acbramley commentedActioned #47
Comment #54
smustgrave commentedShould be good now for review
Comment #55
acbramley commentedNo idea how we both pushed commits at the same time but looks like some other files/patch has leaked into the MR now.
Comment #56
aaronmchaleGood catch, and a quick fix! :)
Comment #57
acbramley commentedNot sure if this is a new restriction but it looks like the MR wants to be up to date with the base branch before being considered mergeable even if there are no conflicts. I'll leave it for now so we don't keep spinning unnecessary test runs.
Comment #59
larowlanCommitted to 10.1.x - thanks all
Comment #61
benjifisherThere is still one remaining task from the issue description:
That documentation should include what to do for less restricted pages (Comment #22):
Comment #62
aaronmchaleGreat to see this land, thanks everyone!
More generally, regarding only passing plain strings to logger, I wonder if we need some kind of type hinting or code sniffing to raise that in the future.