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_moderation module
  • 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

Command icon 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

lauriii created an issue. See original summary.

quietone’s picture

Version: 11.1.x-dev » 11.x-dev

berdir made their first commit to this issue’s fork.

berdir’s picture

Status: Active » Needs review

Created 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.

scott_euser’s picture

Adding similar thing from within Gin to related issues.

plopesc’s picture

It 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.

plopesc’s picture

Created 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.

oily made their first commit to this issue’s fork.

ironnuts’s picture

Added @var docblock to code.

ironnuts’s picture

Issue summary: View changes
berdir’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

We have the test class now.

berdir’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

Added 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.

plopesc’s picture

Status: Needs review » Needs work

Checked 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!

berdir’s picture

Status: Needs work » Needs review

Cleaned 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.

plopesc’s picture

Status: Needs review » Reviewed & tested by the community

Thank 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.

catch’s picture

Do we definitely have tests for this code path with and without content moderation enabled?

berdir’s picture

Yes, \Drupal\Tests\navigation\Functional\NavigationTopBarPageContextTest is a very similar test that doesn't have content_moderation enabled.

m4olivei made their first commit to this issue’s fork.

m4olivei’s picture

Issue summary: View changes

Fleshing out the issue summary to reflect the current state.

m4olivei’s picture

Issue summary: View changes

This 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.

ckrina’s picture

Confirming 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 :)

m4olivei’s picture

Yay! RTBC +1. Thanks @ckrina.

  • nod_ committed 428c9c20 on 11.x
    Issue #3501332 by berdir, m4olivei, oily, plopesc, lauriii, ckrina,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 428c9c2 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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