function content_moderation_post_update_set_default_moderation_state
Set the default moderation state for new content to 'draft'.
File
-
core/
modules/ content_moderation/ content_moderation.post_update.php, line 104
Code
function content_moderation_post_update_set_default_moderation_state(&$sandbox) {
\Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'workflow', function (Workflow $workflow) {
if ($workflow->get('type') === 'content_moderation') {
$configuration = $workflow->getTypePlugin()
->getConfiguration();
$configuration['default_moderation_state'] = 'draft';
$workflow->getTypePlugin()
->setConfiguration($configuration);
return TRUE;
}
return FALSE;
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.