Few months ago I posted similar issue to WB : 2750365; however, based on this comment CM is going to be completely redesigned. Until that happens, moderation states with same name remains unclear.

Moderation state transition list page looks much better than the one in WBM, but on the other hand more confusing.

Current CM list page:

before

Proposed solution:

after

Comments

pericxc created an issue. See original summary.

jhedstrom’s picture

Version: 8.2.0-rc1 » 8.2.x-dev
pericxc’s picture

Status: Active » Needs review
StatusFileSize
new5.98 KB

Status: Needs review » Needs work

The last submitted patch, 3: 2804873.patch, failed testing.

pericxc’s picture

Status: Needs work » Needs review
StatusFileSize
new630 bytes
new6.76 KB
jhedstrom’s picture

It would be good to get some of the other folks that helped review #2750365: Permissions: moderation states with the same name is unclear for user to assign to a role to chime in here as well.

Some code feedback.

  1. +++ b/core/modules/content_moderation/src/Entity/EntityUniqueLabelTrait.php
    @@ -0,0 +1,37 @@
    + * Provides a trait for selecting providing unique labels.
    

    This is off a bit since this trait deals with unique and non-unique. Perhaps "Provides a trait for getting labels."

  2. +++ b/core/modules/content_moderation/src/Entity/EntityUniqueLabelTrait.php
    @@ -0,0 +1,37 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    ...
    +  /**
    +   * {@inheritdoc}
    +   */
    

    I'm not sure traits can use {@inheritdoc}...

  3. +++ b/core/modules/content_moderation/src/Entity/EntityUniqueLabelTrait.php
    @@ -0,0 +1,37 @@
    +    foreach (static::loadMultiple() as $arg) {
    +      $label = $arg->label(FALSE);
    

    Tiny nitpick, how about something more specific than $arg?

  4. +++ b/core/modules/content_moderation/src/Form/ModerationStateForm.php
    @@ -23,7 +23,7 @@ public function form(array $form, FormStateInterface $form_state) {
    +      '#default_value' => $moderation_state->label(FALSE),
    
    +++ b/core/modules/content_moderation/src/Form/ModerationStateTransitionForm.php
    @@ -61,7 +61,7 @@ public function form(array $form, FormStateInterface $form_state) {
    +      '#default_value' => $moderation_state_transition->label(FALSE),
    

    Let's add code comments clarifying why we don't need a unique label here.

  5. +++ b/core/modules/content_moderation/src/ModerationStateTransitionListBuilder.php
    @@ -82,7 +82,7 @@ public function buildHeader() {
    +    $row['label'] = $entity->label(FALSE);
    
    +++ b/core/modules/content_moderation/src/Permissions.php
    @@ -28,7 +28,7 @@ public function transitionPermissions() {
    +          '%transition_name' => $transition->label(FALSE),
    

    And here too.

pericxc’s picture

StatusFileSize
new3.12 KB
new7.13 KB
jhedstrom’s picture

I think since displaying the machine name can be seen as unfriendly, perhaps this patch can be updated to only display the machine name if the site in question has duplicate labels?

pericxc’s picture

StatusFileSize
new2.47 KB
new9.79 KB

Status: Needs review » Needs work

The last submitted patch, 9: 2804873_09.patch, failed testing.

pericxc’s picture

StatusFileSize
new1.18 KB
new9.78 KB
pericxc’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: 2804873_11.patch, failed testing.

pericxc’s picture

Status: Needs work » Needs review
StatusFileSize
new1.07 KB
new10.24 KB

Status: Needs review » Needs work

The last submitted patch, 14: 2804873_14.patch, failed testing.

pericxc’s picture

Status: Needs work » Needs review
StatusFileSize
new3.26 KB
new8.86 KB

Status: Needs review » Needs work

The last submitted patch, 16: 2804873_16.patch, failed testing.

pericxc’s picture

Status: Needs work » Needs review
StatusFileSize
new1.12 KB
new9.38 KB

Status: Needs review » Needs work

The last submitted patch, 18: 2804873_18.patch, failed testing.

lomasr’s picture

StatusFileSize
new117.35 KB

Applied the patch #5 worked cleanly but cant see the machine name added. Do I need to Add moderation. Please see screenshot.

pericxc’s picture

hi @lomasr machine_name will appear ONLY for duplicate labels. In order to see the results, create one more Draft state ( or published).

pericxc’s picture

Status: Needs work » Needs review
StatusFileSize
new2.99 KB
new7.79 KB
sam152’s picture

Status: Needs review » Closed (outdated)

Better status given the issue linked in #23?