Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The moderation state field is configurable in form displays, but it doesn't seem to respect its configured weight. Even if you move the moderation state to the top of the form display, it will still be displayed towards the bottom.
Screenshots, from #16:
If you move the moderation state to the top of the form...
...it still shows up at the bottom.
Proposed resolution
Fix it!
Remaining tasks
Write a patch, with tests, and commit it. Wash, rinse, repeat.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
KelvinWong CreditAttribution: KelvinWong commentedMaking moderation_state field configurable in node form.
Comment #3
KelvinWong CreditAttribution: KelvinWong commentedComment #4
phenaproximaThis is a nice find and a good solution, but let's change this to something a little more efficient. Assuming the fields are keyed by name (and they should be), this could be something like:
We will probably also need a test of some sort, to prove that the field is actually made configurable. A kernel test oughta do the trick; all it would need to do is install the entity schema of a moderatable entity type, ensure that moderation is enabled for it, then assert that the moderation_state field is marked as configurable.
Another option would be to simply file this patch against Workbench Moderation itself, and Lightning could bring the patch in. That would be preferable, in fact, since more people could then have this fix without needing to use Lightning.
Comment #5
KelvinWong CreditAttribution: KelvinWong commentedThanks phenaproxima, the patch is updated.
This patch is not application for the original Workbench Moderation module, as the state options they provided are embedded in the submit button, so the field doesn't need to be configurable. It will be a good idea if Workbench Moderation module provides options to choose between a standard submit button and a submit button with moderation states dropdown.
I will also give the kernel test a go.
Comment #6
bkosborneThanks for working on this... was driving me nuts. Let me know if you need a hand Kelvin, I can take a shot at the tests as well.
Comment #7
balsamaComment #8
bkosborneThere's a patch for this in WBM: #2833892: The ability to rearrange moderation state field in the form
But as I noted there, this change also allows site builders to change the field widget off of the one provided by workbench moderation. Using any other field widget makes no sense and could introduce confusion and bugs.
I wonder if there's another way around this =/
Comment #9
amenity CreditAttribution: amenity commentedI agree with @bkosborne, this patch isn't yet ideal. However, since the intent of Lightning is to allow developers to improve the editorial experience, I'd err on the side of making it confusing for site builders rather than muddying the editor UX.
Comment #10
balsamaLet's see if we can use WBM patch and set sane defaults.
Comment #11
KelvinWong CreditAttribution: KelvinWong commentedI don't think that is an issue with WBM. The moderation state field is embedded in the submit button by default. See attached screenshot. Hence there is no need to set the weight of it, as it is always showing up together with the submit button.
It is however, the lightning_workflow feature overriding the default behaviour of the moderation_state field, and have it as a separated dropdown field. That is why we have to enable weight setting, otherwise the field will always have a default weight of 5.
Comment #12
KelvinWong CreditAttribution: KelvinWong commentedAdded updated patch. This patch is tested with lightning 8.x-2.17.
Comment #13
phenaproximaWe're currently in the process of building an upgrade path from Workbench Moderation to Content Moderation. So I'd like to postpone this on that.
Comment #14
balsamaJust tested this on Lightning 2.2.5 (with Content Moderation) and the problem still exists. But, I also confirmed identical behavior with the standard install profile. So this doesn't appear to be Lightning-specific.
Comment #15
phenaproximaOkay, we need to move this to core. Thanks for testing, @balsama!
Comment #16
balsamaSome screen shots for clarity. Move the "Moderation state" field above title:
But it remains at the bottom of the form:
Comment #17
phenaproximaComment #19
Wim LeersAFAICT this exact bug was reported again exactly one year later: #2925182: Content moderation widget cannot be reordered …
Comment #20
dpiMarking as duplicate of #2925182: Content moderation widget cannot be reordered since that issue was in the core queue before this one.
Feel free to continue discussion there, or move back to Lightning.