Problem/Motivation
#3484600: Show entity information on the Top Bar added information about publishing status to the Navigation Top Bar. When content moderation is in use, we should display to the user more specific information about the workflow state that the content is in (i.e. in review, draft, etc)

Steps to reproduce
- Enable navigation and navigation_top_bar, eg.
drush en -y navigation_top_bar - Enable
content_moderationmodule - Configure the "Editorial" workflow for Articles. Visit
/admin/config/workflow/workflows/manage/editorial - Under "This workflow applies to", setup the Article Content Type
- Create a new Article
- View the article
Expected behavior
The publishing status (badge) in the Navigation top bar, should show the workflow state. When viewing the default revision, if there is a pending revision, indicate the pending revision.
Actual result
Only "Published" or "Unpublished" is shown for the publishing status (badge) in the Navigation top bar. Workflow state of the default revision, and/or pending revisions are not displayed.
Proposed resolution
Include workflow state in the publishing status (badge) in the Navigation top bar.
Remaining tasks
Review
User interface changes
Adding the workflow state, when available, to the Navigation top bar.
Issue fork drupal-3501332
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:
- 3501332-display-content-moderation
changes, plain diff MR !10979
Comments
Comment #2
quietone commentedComment #5
berdirCreated a merge request that supports showing the workflow state as well as a pending draft message. no additional colors or anything, I think it might make sense if the pending draft part would be a separate badge or something that you can click, then we could hide the latest version on the more actions as well.
didn't think about responsive or anything, just laying the groundwork so people who know about frontend can pick it up from this.
Comment #6
scott_euser commentedAdding similar thing from within Gin to related issues.
Comment #7
plopescIt looks great as an initial approach, suggested improvements could be discussed with the UX team.
Would be great to have some test coverage for this one too.
Comment #8
plopescCreated a Content Moderation specific test class as part of #3501934: Navigation Top Bar should display Edit button as the primary action when viewing a forward revision that could be useful to define the tests in this issue.
Comment #10
ironnuts commentedAdded @var docblock to code.
Comment #11
ironnuts commentedComment #12
berdirWe have the test class now.
Comment #13
berdirAdded basic tests for this and removed the incorrect @var, ready for review again.
I also brought this up a bit in slack here: https://drupal.slack.com/archives/C7AB68LJV/p1738147489939009.
As mentioned there, I don't have any strong feelings on color, the current ones work for me, I as mentioned, I'd rather suggest to use warning/yellow to highlight content that is not yet published than for a pending draft, that seems like a more complex change that needs design review and isn't in scope for this.
I do think it would be neat to somehow make this link to the Latest version, but that can be explored later as well and the latest version link is fairly close.
To me this seems like a useful intermediate step forward as it is.
Comment #14
plopescChecked the code and looks good to me. Added a couple of comments in the MR that might help to clean it up a bit.
Agree that a possible 3rd color for this new status might be a good addition, but we could use this MR as an intermediate step while the UX and design teams come up with a final solution.
Thank you!
Comment #15
berdirCleaned up DI. Note that $entityTypeManager is already unused in HEAD and was replaced with $entityRouteHelper, I'm just adding an additional load for the latest revision.
Comment #16
plopescThank you for the clean up and taking care of the unused dependency. That was my fault, I think.
From my perspective, it can be marked as RTBC.
Comment #17
catchDo we definitely have tests for this code path with and without content moderation enabled?
Comment #18
berdirYes, \Drupal\Tests\navigation\Functional\NavigationTopBarPageContextTest is a very similar test that doesn't have content_moderation enabled.
Comment #20
m4oliveiFleshing out the issue summary to reflect the current state.
Comment #21
m4oliveiThis looks good to me!
My only hesitation would be that there isn't any design/product input here. I don't see any consideration for workflow / content moderation in the Figma designs I have seen for experience builder or otherwise. I'm not sure how much that matters. I would guess maybe some of that happened offline given @lauriii filed the issue.
Comment #22
ckrinaConfirming that we reviewed the designs of this in the Top Bar in with Lauri and the XB design team, so this is good to go. Thanks for checking Matt :)
Comment #23
m4oliveiYay! RTBC +1. Thanks @ckrina.
Comment #26
nod_Committed 428c9c2 and pushed to 11.x. Thanks!