Problem/Motivation

This method gets the wrong entity type (the bundle entity type, not the entity type itself) and calls canModerateEntitiesOfEntityType instead of shouldModerateEntitiesOfBundle, meaning the alterations (if they worked) would apply to bundles not under moderation.

Proposed resolution

Fix this or as suggested in #2842042: Review, organise, and clean up content moderation handlers, remove it altogether.

Remaining tasks

Review.

User interface changes

None right now as the implementation is broken.

API changes

Removes a method on an interface.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sam152 created an issue. See original summary.

Sam152’s picture

Status: Active » Needs review
FileSize
2.76 KB

Here is the fix, can write a test if it's decided to keep the method.

Sam152’s picture

timmillwood’s picture

Issue tags: +Needs tests

I guess if this wasn't working, and nobody noticed, then we do need tests for it. As you said "if it'd decided to keep the method", I'm not sure we need it. I'd say just stick it in the form alter and remove it from the handler.

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.

szato’s picture

Patch updated to actual 8.4.x-dev code.

timmillwood’s picture

Still needs test ;)

szato’s picture

Assigned: Unassigned » szato
Status: Needs review » Needs work
szato’s picture

  1. Changed disabled #default_value to #value (@see https://www.drupal.org/node/2852063)
  2. Test 'testEnforcedRevisionForModeratedContentType' added
szato’s picture

Assigned: szato » Unassigned
Sam152’s picture

This is possibly a follow-up, but it's annoying these values aren't enforced at the entity level. It would add more to the handler interface, which is bad, but at the same time this is kind of funky that you have to go an resave the bundle edit form for anything to happen, yet it's not actually broken in the meantime. It's also a config bundle-centric part of the handler interface.

I think perhaps we should just bite the bullet and remove this, I'm sure that's a solution @timmillwood can get on board with :)

Sam152’s picture

Title: Fix or remove the enforceRevisionsBundleFormAlter method for content moderation handlers » Remove the enforceRevisionsBundleFormAlter method because right now it doesn't do anything and nothing is broken as a result
Issue summary: View changes
Sam152’s picture

Title: Remove the enforceRevisionsBundleFormAlter method because right now it doesn't do anything and nothing is broken as a result » Remove dead code by way of enforceRevisionsBundleFormAlter

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.

catch’s picture