Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
When adding a relationship to the content_moderation_state
entity in a view, the machine name of the current state displays, rather than the state's label:
Steps to reproduce
- Add a view of a moderated entity type (eg, Content)
- Add a relationship to the 'Moderation state'
- Add the moderation state field* using the relationship
*This is not to be confused with the calculated moderation state field (#2859381: Broken/missing handler for Moderation state field).
Proposed resolution
The Views data should specify the appropriate formatter for this field (I think it's ContentModerationStateFormatter
, but am not positive).
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#3 | moderation_state_field-2860907-3.patch | 1.62 KB | GoZ |
Comments
Comment #2
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedThe formatter assumes it's for the computed field, but could probably be made to work with both. As discussed in #2859381: Broken/missing handler for Moderation state field, we can make the computed field work in views once this bugfix gets in: #2852067: Add support for rendering computed fields to the "field" views field handler
Comment #3
GoZ CreditAttribution: GoZ at Barbe-Rousse, Centarro commentedMaybe it's not the best way to deal with this (we still have a broken handler), but here is a patch which display label instead of key.
Comment #4
timmillwoodComment #5
mstef CreditAttribution: mstef commentedWorks. Thanks.
Comment #7
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedIn #2902187: Provide a way for users to moderate content, the moderation state views field correctly displays the label of a state instead of its ID, so this must have been fixed somewhere else in the meantime.
Comment #8
sukanya.ramakrishnan CreditAttribution: sukanya.ramakrishnan commentedThis issue is still there without the patch being applied. As the description says, it happens only when a relationship to content moderation state is added and the field from the relationship is added to the view.
The issue doesnt occur when the moderation state field from the node table is directly used instead of a relationship,
seems like It was fixed here https://www.drupal.org/node/2852067
Comment #9
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedFixed since #2859381: Broken/missing handler for Moderation state field by using the computed field directly on the entity.