Problem/Motivation
Part of #3624760: Plan: consistent Display Builder entry points in the Navigation top bar. Follows #3616421: Add a navigation toolbar item in page built with Display builder, merged for its logic: route checks, cache tags, access.
#3616421: Add a navigation toolbar item in page built with Display builder renders the page layout as a featured link, "Edit page display". Featured means primary: on a node page it sits before core's "Edit", so the page gets two primary buttons, and the one with the widest reach comes first. Its label also reads as "edit this page", while it edits a layout shared by every page matching its conditions.
#3624762: Top bar entry for the main content display: bundle display or override and #3624763: Top bar entry for Views page displays add more entries to the same place, so they need an item that can hold several.
Proposed resolution
- A text-only "Display" button in
TopBarRegion::Actions, not primary, weighted after core'spage_actions. Core's "Edit" stays the only featured action. - It opens a
toolbar-dropdownlisting the layers that built the current page, outer to inner, each with a second line saying how far a change reaches. - The item moves from
display_builder_page_layoutto the main module. Submodules contribute entries; this issue ships the page layout one, labelled "Page layout: label" with "Pages matching its conditions". - Each entry carries its own access and cacheability, merged into the item.
- No item when no entry is accessible, so the top bar does not appear for us alone on pages with nothing to show.
Mockups: see #3624760: Plan: consistent Display Builder entry points in the Navigation top bar.
Remaining tasks
- Decided to use a hook for submodules links, as it's a common Drupal way, could be challenged for event or tagged service but imho hook fits well. Keep it internal until #3624762: Top bar entry for the main content display: bundle display or override and #3624763: Top bar entry for Views page displays prove it's right.
- Tests: the Display trigger, its page layout entry and target on a page with a layout; core's "Edit" is the only featured action on a node page; no item for a user without the permission.
- Axe stays at zero with the dropdown open.
User interface changes
"Edit page display" primary button replaced by a "Display" dropdown after core's page actions.
Issue fork display_builder-3625022
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:
Comments
Comment #2
mogtofu33 commentedComment #3
mogtofu33 commentedComment #5
mogtofu33 commentedComment #6
pdureau commentedCode review
Looking at the template, it seems
top_bar_displayis not a proper UI component because it is mixing its own markup with some from Navigation module's templates : https://git.drupalcode.org/project/display_builder/-/blob/d69bf64e4a6c8e...Would it be better to simply "componentize"
toolbar-dropdownin a proper SDC, without anything specific to Display Builder, we can use right now? WithSo, we can also propose a Core issue to ship this template as a component and we will be able to "clean" this next year.
Feature review
Feature is great, but "Pages matching its conditions" wording is confusing in:
Why "Pages" in plural when rendering a single page? What is "it" in "its conditions"?
Before proposing anything, what would be the descriptions of the other buildables (entity view, overrides, view display)?
Comment #7
mogtofu33 commentedThe core issue is a good idea to help extend the navigation top bar menu, probably the 3 dots.
For the wording let's move that as a wrapping up issue, it's not blocking and as you say will make sense when everything is in place, created #3625203: Top bar wording review and adjustment added to the plan.
For our component, I think it's already generic, but ok to do something that can help a future core issue I switched to a
toolbar_dropdowncomponent to review.Comment #8
pdureau commentedThe template is weird with a missing BEM block class (
.toolbar-dropdown) but I guess it is to follow the existing weirdness of navigation modules templates:So, RTBC.
Comment #9
mogtofu33 commented