Problem/Motivation

The handlers, specifically NodeModerationHandler in Content Moderation have a lot of confusing code, they might not even be needed at all. There are also form alters in there, is that the best place to be doing them, are they even needed?

Proposed resolution

- Review, organise, and clean up the code.
- Comment throughout to make it clear why this stuff is happening here.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

timmillwood created an issue. See original summary.

Sam152’s picture

We should also write test cases that fail if the code is removed, to prove that it's required.

Sam152’s picture

To address the form alters; it looks like these are there to enforce UI elements that control revisions to always be on. Both in the bundle configuration form for defaults and the entity form for specific items of content.

I don't think there is a way to determine how the entity type has decided to construct its entity form, so I don't think these can be removed. New revisions are already created automatically, but the question is if we want the UI to say a new revision will not be created when it really will. If we can live with that, then all of these can go.

timmillwood’s picture

I think the form alters can be moved to the actual form alter hook with either a switch on entity type, or a check if the element exists in the form array.

Sam152’s picture

The ironic part of this is the bundle alter handler serves a purpose but is currently broken. See #2843380: Remove dead code by way of enforceRevisionsBundleFormAlter.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tacituseu’s picture

Didn't want to create an issue out of it, but core/modules/content_moderation/src/EntityTypeInfo.php contains leftover from times it was an 'entity_reference':

      ->setSetting('target_type', 'moderation_state') 

Edit:
also
core/modules/content_moderation/src/Plugin/Validation/Constraint/ModerationStateConstraintValidator.php injects StateTransitionValidation but doesn't use it
Edit 2:
moved to #2900421: Architectural review of the Content Moderation module

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

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.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Sam152’s picture

Status: Active » Closed (outdated)