π¬ | Drupal core | Configuration import fails: Undefined array key "moderation_state" BaseFieldOverride
I have the same issue with Drupal 10.3.0 (and 10.2.x).
My website is also a multilanguage one and "drush cim" fail on content moderation field import.
The last patch in the proposed thread generates a different error. In the thread they mention that the moderation state field is not a translatable one and this is probabably the cause of the error.
#17 partially worked for me in Drupal 10.3.0 and 10.2.3
I use an aggregartion on content moderation states field with the count aggrator in combination with the chart module.
I've solved my issue with tha hook_views_query_alter
function hook_views_query_alter(ViewExecutable $view, $query):void
{
//Fix bug for views on content moderation
if(!empty($query->fields)){
foreach($query->fields as $kf=>$field){
if(isset($field['function'])){
if($field['field']=='moderation_state'){
$query->fields[$kf]['table']= 'content_moderation_state';
}
}
}
}
}