Move block content edit and delete routes under admin/content/block to improve IA for editors and fix breadcrumbs

Created on 8 August 2014, over 10 years ago
Updated 28 April 2023, over 1 year ago

Previously a follow-up to #2314863: Standardize block content entity route names . This is now a follow-up to Move Custom block library to Content Fixed and part of 🌱 [meta] Reorganize Block items in the administration menu Active .

Problem/Motivation

When working with custom blocks the breadcrumb does not provide a useful trail, it generally only contains the "Home" link, which is not very useful when there is a good chance the that user has come from the "Custom blocks" list.

According to the Nielsen Norman Group: "Breadcrumbs should display the current location in the site’s hierarchical structure, not the session history."

Nielsen Norman Group: Breadcrumbs: 11 Design Guidelines for Desktop and Mobile

Unlike Nodes, which have a canonical view and where they are most commonly accessed from the front-end of the site, Custom Blocks do not have a canonical view and are never intended to be directly accessed by anyone other than site administrators/editors. Custom Blocks are designed to be embedded within other content on the site, or within the site regions directly. Therefore, there is no reason for the Breadcrumb Trail not to be the "Custom blocks" list.

During 📌 Drupal Usability Meeting 2023-01-13 Fixed , it was also noted that (as seen in the previous screenshot) when on any of the custom block local tasks, the breadcrumb contains the ID of the block. This is not very useful and to be consistent with other core content entities, the custom block title should be shown. This will be addressed in the follow-up issue 🐛 Breadcrumb for local tasks of Custom Blocks should contain the name of the custom block not the entity ID Fixed .

Proposed resolution

The Custom Block Entity Route paths will be changed from /block/<block> to /admin/content/block/<block>.

Doing this will achieve the result of having the Breadcrumb Trail point to the "Custom blocks" list, but will also mean the URLs are consistent with the Breadcrumb.

This solution was presented and validated at 📌 Drupal Usability Meeting 2023-01-13 Fixed .

The new path referenced above is being implemented as part of Move Custom block library to Content Fixed . In that issue the technique of changing the route path, but creating temporary/deprecated redirect routes using the old path, is being used. The same approach should be used here.

Detailed changes

  1. Change the canonical path (edit form) for a custom block from /block/{block_content} to /admin/content/block/{block_content}.
  2. Make similar updates for the child paths .../delete (delete form) and the revision paths.
  3. Update the revision paths in block_content_update_10100().
  4. Add redirects from the old paths to the new ones, with warnings in the browser and the logs. Add tests for the redirects.
  5. Update automated tests for the changes to the paths and to the breadcrumbs.

There are no changes to the path /block/add and its child paths.

The base path /admin/content/block is the "Custom blocks" list, formerly the "Custom block library". Therefore, the path-based breadcrumbs for the changed paths now start with Home > Administration > Content > Custom blocks.

Remaining tasks

User interface changes

Breadcrumb for Custom Block Entities will update to use the "Custom blocks" list as the Breadcrumb Trail.

Before this issue

This screenshot for the block-edit form in the Umami demo profile shows the path /en/block/5 and the single breadcrumb "Home":

This screenshot for the block-delete form in the Umami demo profile shows the path /en/block/5/delete and the breadcrumbs "Home > (block title)":

After this issue

(Update needed: the screenshots were taken before 📌 Rename Custom Block terminology in the admin UI Fixed was fixed, so they show the path admin/content/block-content/.)

This screenshot for the block-edit form in the Umami demo profile shows the path /en/admin/content/block/5 and the breadcrumbs "Home > Administration > Content > Custom blocks":

This screenshot for the block-delete form in the Umami demo profile shows the path /en/admin/content/block/5/delete and the breadcrumbs "Home > Administration > Content > Custom blocks > (block title)":

API changes

📌 Task
Status

Fixed

Version

10.1

Component
Block content 

Last updated 16 days ago

Created by

🇫🇷France andypost

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    @benjifisher: Would it not still be "[PP-1]" though, since this issue is only postponed on one issue. If the "[PP-N]" in issue titles started tracking all the issues postponing the issues that the issue is postponed on, I could see that getting confusing fast. (I realise that was probably a bit hard to parse, hopefully you get what I mean)

  • Status changed to Active almost 2 years ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    I think we can action this now

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    Updated remaining tasks now that this is no longer postponed.

  • 🇺🇸United States smustgrave

    Actually think this could be closed. Appears to already be fixed.

  • 🇩🇪Germany rkoller Nürnberg, Germany

    for the revisions tab it seems fixed by this issue 🐛 Breadcrumb for local tasks of Custom Blocks should contain the name of the custom block not the entity ID Fixed but the edit tab of a block still only contains the home link in the breadcrumb - the current page of the custom block is missing.

  • 🇺🇸United States smustgrave

    FYI the solution should probably be generic as I see the same behavior for media items.

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    The proposed solution is less about making changes to the breadcrumb, and more about changing the path of block content entities to sit under the block content library, thereby also making the breadcrumb more useful.

  • 🇺🇸United States smustgrave

    That would also have to be generic I think. We don't do that for media or content.

    If we changed the URL to be /block/1/edit though vs just /block/1 when editing that may fix the breakcrumbs but think the issue is we don't have a view route like we do for nodes.

  • Assigned to benjifisher
  • 🇺🇸United States benjifisher Boston area

    I am assigning this issue to myself and working on it today. After 3 days, feel free to re-assign it if I forget to.

    At first I considered updating paths like /block/add as part of this issue. I still like the idea, but it is out of scope for this issue and should be done at the same time as other entity types. Maybe someone already said as much.

    I was also a little worried about using the path /admin/content/block-content/{block_content} because there is no fixed part after /admin/content/block-content. What if we do eventually change the path of the block-add form, and someone uses add for {block_content}? Then I noticed the condition block_content: \d+ and I stopped worrying.

  • @benjifisher opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States benjifisher Boston area

    3772 is ready to review.

    Surprisingly, I updated only one line in the tests. It helps to search for /block/ that is not preceded by admin/structure and to ignore fixtures.

    I am worried that we should add a redirect for /block/{block_content}/translations. This may also be a problem for 📌 [PP1] Move "Block layout" from Structure to Appearance Postponed .

    Since Add Block Content revision UI Fixed was already fixed, I update the revision paths in the entity annotations and the update function. I think it is OK to update the update function because it is not yet part of a release. It might cause a little trouble for those of us who work with 10.1.x regularly. We might also update the screenshots in the change record for that issue . I do not see any reference to the path, but the breadcrumbs are visible in the screenshots.

    I notice that the block ID, not the title, shows up in the breadcrumb for the delete form and the translations page. In order to manage scope, I do not plan to do anything about it for this issue.

  • 🇺🇸United States dalemoore

    I’m not sure how this works, can’t see the code, and I’m on my phone, but just wanted to add that /admin/structure is not a guaranteed path since there are modules that can rename the admin path . I maintain a site where the previous developer used it to rename it from /admin/ to /backend/ presumably because the previous non-Drupal site used that path.

  • 🇺🇸United States benjifisher Boston area

    @dalemoore:

    Thanks for pointing that out.

    I had a quick look at that module. From the description (project page and README) and the event subscriber, it looks as though it works by altering routes. I am pretty sure that the changes here will "play well" with that module.

    Example: assume that module is configured to change admin to backend

    Before this issue, the entity.block_content.edit_form route has the path /block/{block_content} (for example, /block/17). The module would not change it.

    After this issue, the entity.block_content.edit_form route has the path /admin/content/block-content/{block_content}. The module would change it to /backend/content/block-content/{block_content}.

  • 🇺🇸United States dalemoore

    Sounds great! I wasn’t worried since this (D7) site will be merged into our new D10 site but figured I’d pop in and advocate for those who do use it just in case. Thanks!

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    Can the issue summary be updated as well? Seems to be changing the route to something else from the proposed solution.

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States benjifisher Boston area

    After hacking the tests to figure out why they were failing, I rebased and force-pushed to simplify the git log.

    I am updating the issue summary. I think that I implemented what was intended, but the proposed resolution was not very explicit.

  • 🇺🇸United States benjifisher Boston area

    I am making some further changes to the issue summary. The first line of the "Proposed resolution" section was

    The Custom Block Entity Route paths will be changed from /block/ to /admin/content/block/.

    Before Move Custom block library to Content Fixed , the "Custom block" list at /admin/content/block-custom was the "Custom block library" at /admin/structure/block/block-content. The line here was either a mistake or a guess as to where the page would end up.

    I am fixing that line and changing "Custom block library" to "Custom block" list. The parts in quotation marks are the page titles.

  • 🇺🇸United States smustgrave

    We also have the renaming ticket where I think we are changing the page to Block Content

  • 🇺🇸United States benjifisher Boston area

    I added 🐛 Create BC redirects for children of changed paths Fixed . In order to manage scope, I would like to handle redirects for child pages in that issue, not this one. (If that issue is fixed first, then it should be easy enough to handle the redirects in this issue.)

    I would like to get this issue done in time for 10.1.0-alpha1 because the path changes are disruptive and because this issue updates an update function. I think it is all right if the redirects for child paths are added later. Another reason to handle these redirects in a separate issue is that we already have child paths that need redirects after 📌 Move custom block types admin link to admin/structure Fixed .

  • 🇺🇸United States benjifisher Boston area

    I am adding screenshots to this issue, and I will add them to the change record. I already updated the text part of the change record.

  • 🇺🇸United States benjifisher Boston area

    The MR already includes new tests and fixes old ones. I am removing the tag for needing tests.

  • 🇺🇸United States smustgrave

    Applied the MR locally.

    Couldn’t get the update hook to run without changing the number to 10201.

    After the update ran, cleared cached and all the breadcrumbs appear to match the screenshots in the issue summary.

  • 🇺🇸United States benjifisher Boston area

    The update hook does not have to work from one version of 10.1.x to the next, until we get to the alpha release of 10.1.0. In fact, we might not guarantee an upgrade path until the beta release.

    That is why I have been saying that the update-update is a reason to get this issue done before the alpha release.

    If you want to test the upgrade path, then

    1. Check out some version of Drupal 10.0 (such as 10.0.x or 10.0.7).
    2. composer install
    3. Install Drupal.
    4. Check out the branch for this issue from the issue fork.
    5. composer install
    6. Execute update functions (drush updatedb or visit update.php in a browser).
  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    As brought up in the slack channel #block-content with you, me, and @larowlan this should be able to run on 10.1.x also.

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    Re comment #60:

    The Custom Block Entity Route paths will be changed from /block/ to /admin/content/block/.

    Before Move Custom block library to Content Fixed , the "Custom block" list at /admin/content/block-custom was the "Custom block library" at /admin/structure/block/block-content. The line here was either a mistake or a guess as to where the page would end up.

    When I originally wrote the issue summary, I wrote it with the assumption that by the time we got to this issue, the path would end up being /admin/content/block, the change from /admin/content/block-custom to /admin/content/block looks like it is being done as part of 📌 Rename Custom Block terminology in the admin UI Fixed . So if that gets committed first, we can then update the IS again.

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    Looking at the MR here, I think we should postpone this issue on 📌 Rename Custom Block terminology in the admin UI Fixed , given that issue is changing the block content overview path, I think it makes more sense to get that one committed, then update this issue with the updated path.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,285 pass
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States benjifisher Boston area

    Now that 📌 Rename Custom Block terminology in the admin UI Fixed is fixed, I have updated the MR, so this issue is again ready for review.

    Re Comment #67: #3318549 already updated the update function, so I think it is OK to do it again in this issue, as long as we get this issue fixed before 10.1.0-alpha1.

  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States smustgrave

    Going to mark this as I did a fresh install with the changes already applied and the breadcrumbs are working much better then before.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,285 pass
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,304 pass
  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,304 pass
  • Status changed to Needs review over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    One minor question regarding the duplicate route.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Tagging as a 10.1 should have. Not the end of the world, but ideally.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Adjusting title to reflect the resolution

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    29,306 pass
  • Status changed to RTBC over 1 year ago
  • 🇺🇸United States smustgrave

    Test appear green so assuming the duplicate just wasn't needed.

    • larowlan committed 32671f55 on 10.1.x
      Issue #2317981 by benjifisher, ohthehugemanatee, larowlan, andypost,...
  • Status changed to Fixed over 1 year ago
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Committed to 10.1.x and updated the change record

  • 🇬🇧United Kingdom longwave UK
  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    I updated the release notes for this (but neglected to mention above)

  • 🇬🇧United Kingdom AaronMcHale Edinburgh, Scotland

    Awesome to see this get committed!

    But also because it now opens up the possibility of looking at this for other entity types (taxonomy, media, etc) where there's a strong case for making the path and breadcrumb work in the admin UI, while also not breaking the breadcrumb for other accessing those entity types on the front-end. That's a much harder problem to crack, this was definitely the low hanging fruit one!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024