views_moderation_state_weights
Introduction
Out of the box, Drupal's content moderation module does not expose moderation state weight information to Views. This module provides field and sort handlers to facilitate this functionality.
This module can be used if you need to display Views results sorted by moderation state, but in a specific user-defined order. Simply set the order in which you want states to appear in the content moderation workflow configuration, then add the "Moderation state weight" sort criteria to your View.
How it works
Since Views sorts are executed by the database, moderation state weight information needs to be easily accessible from the database. Upon installation, this module creates a table containing moderation state weight information for each content moderation workflow. Each time a content moderation workflow is updated, the database table is also updated.
When adding one of the Views handlers provided by this module to a View, the handler will automatically join the moderation state weight table in the database, which allows the database to order the result set by moderation state weight.
Internal API usage
To fulfill the functionality delivered by this module, we rely on parts of Drupal that are likely considered to be part of its internal API; specifically, the content_moderation_state entity type and any related database structure and machine names. However, the risk should be minimal since we believe a backward incompatible change is unlikely.