1. Enable Content Moderation module.
2. Create a new content type. Accept the defaults. "Create new revision" will be checked and grayed out (it appears the disabling is done by Content Moderation).
3. At this point, the new content type is not yet subject to Content Moderation. Create a node of the content type. Save the node.
4. Edit the node you just saved. The "Create new revision" box will NOT be checked, even though it should be checked (because "Create new revision" is checked on the content type edit page).
When you export the config with "drush cim", the config for the content type has "new_revision: false", but the interface shows it as checked (true).

Comments

ptmkenny created an issue. See original summary.

timmillwood’s picture

Version: 8.4.0 » 8.5.x-dev
Issue tags: +Workflow Initiative

Thanks for opening the issue!

Looks like instead of altering the form in \Drupal\content_moderation\Entity\Handler\NodeModerationHandler we should alter the actual config (and the form). We should also only do the alters if moderation is enabled.

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 could lead to unexpected data loss?

Georgii’s picture

@timmillwood
#2

Looks like instead of altering the form

I think that modifying the form may still be needed to cover the case of creating new content types. However this approach require some investigation as well because of the following. It looks like Drupal ignores any field that is ['#disabled']. Therefore the following code will not force a node type to become "new revision by default" even if you create or update that node type.

$form['workflow']['options']['#default_value']['revision'] = 'revision';
$form['workflow']['options']['revision']['#disabled'] = TRUE;
we should alter the actual config (and the form). We should also only do the alters if moderation is enabled.

I guess you mean when Moderation is actually enabled for a certain content or block type. Right?

merilainen’s picture

FYI Workbench moderation has the same issue and I suppose the fix was to change #default_value to #value #2852063: Enforced "Create new revision" isn't saved to the config. I don't use that module so I haven't tried the patch out.

timmillwood’s picture