As of 8.4.x for Nodes, and 8.5.x for all entities, the position of the content moderation widget cannot be changed.

This is due to the magic 'footer' group created by #2892304: Introduce footer region to ContentEntityForm.

manage form display, before, after

Preferably the 'footer' group (#2892304: Introduce footer region to ContentEntityForm) is reverted, as it circumvents form displays.

Comments

dpi created an issue. See original summary.

dpi’s picture

Status: Active » Needs review
StatusFileSize
new5.65 KB

Attached a patch:

  • Stops the moderation widget from using the group
  • Tests to assert the position of the widget on Manage form display matches on entity edit forms.
timmillwood’s picture

It was decided during UX review that the moderation state widget should appear in the footer region, replacing the publishing status checkbox.

Maybe instead we should change ->setDisplayConfigurable('form', TRUE) to ->setDisplayConfigurable('form', FALSE) in \Drupal\content_moderation\EntityTypeInfo::entityBaseFieldInfo. Making it impossible to reorder the content moderation widget.

dpi’s picture

Status: Needs review » Needs work
dpi’s picture

Status: Needs work » Needs review

#4 is expected failure.

@timmillwood

Whatever the case, the current situation needs improvement.

Seems unfortunate that this limitation is in place, if a site builder wants it in a special region, why cant he use a custom layout for it?

jibran’s picture

After ->setDisplayConfigurable('form', TRUE) and removing the field from the form I see the following error.

Notice: Undefined index: widget in Drupal\content_moderation\EntityTypeInfo->formAlter() (line 357 of core/modules/content_moderation/src/EntityTypeInfo.php).
timmillwood’s picture

@jibran - @sam152 has a patch for that somewhere.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wim leers’s picture

AFAICT this exact bug was already reported exactly one year earlier: #2829265: The weight of moderation_state field is not changeable

jibran’s picture

dpi’s picture

AFAICT this exact bug was already reported exactly one year earlier:

...couldnt discover the other because it was in the Lightning queue :/

berdir’s picture

This element behaves the same as the published field, and it was moved there to provide a good UX by default, because this allowed us to make sure it remains close to the save button and separate it from the rest of the form with a vertical line.

I understand that this doesn't work for everyone, but was done like that based on the input of the usability team. I don't think this patch has a chance to be committed* in its current form, it might be an improvement for some but it will also be a regression for at least as many other sites.

If you don't like it there then you could for now implement a form alter or someone could create a contrib module that would do that for the time being.

I think a more realistic way to make everyone happy is to try and use the layout_builder module also for the form display and not just the view display and move all those special cases (including all the vertical tabs and so on) into configuration instead of code. This field is just one example of many that have existing hardcoded assumptions about the layout: The revision checkbox + log message, the path module, comment settings and so on. Many of those don't work for everyone, especially for forms that are not using the administration theme (layout per-theme does introduce another layer of complexity to layout builder that I think it currently can't handle though..)

* That is my personal opinion.

timmillwood’s picture

Assigned: dpi » Unassigned
Issue tags: +Needs usability review

@Berdir +1 to that.

There was a lot of work and discussions gone into the "footer" part of the content entity form and how the publishing status and moderation state would use it.

We at least need to bring in the UX team here again.

I did suggest in #3 we should prevent the reordering of the moderation state field, much like we do with the publishing status field. Wouldn't this stop all the discussion?

jibran’s picture

Status: Needs review » Closed (won't fix)

implement a form alter

Yeah, this gives me more control. Let's won't fix this.