Problem/Motivation
In #3037136-3: Make Workspaces and Content Moderation work together, @plach brought up a review point:
+++ b/core/modules/workspaces/src/EntityTypeInfo.php @@ -77,6 +77,24 @@ public function entityTypeBuild(array &$entity_types) { + public function entityTypeAlter(array &$entity_types) {As mentioned above: could we move this to CM? I'm wondering whether we could even change the logic in
LatestRevisionCheck::access()code to further/only check that the latest revision is not also the default revision, regardless of it being pending. This would address WS implicitly without having to do a module exist or check that the entity type is handled by WS.
And @amateescu's reply:
We could, but it's harder to do it in CM for two reasons:
I'm wondering whether we could even change the logic in
LatestRevisionCheck::access()code to further/only check that the latest revision is not also the default revision, regardless of it being pending.The problem with doing it only in the access check is that the latest-revision link template would still be registered, and there's a lot of code in CM that's doing stuff conditionally based on the existence of that link template, so it's better to not have it in the first place.
This would address WS implicitly without having to do a module exist or check that the entity type is handled by WS.
If we want to do the module exists and workspace-supported check in CM, it means that we'd need to inject the workspace manager conditionally somehow into \Drupal\content_moderation\EntityTypeInfo.
Based on the two points above, I think it's easier to leave that conditional logic in Workspaces.
Proposed resolution
Discuss whether we want to move the current logic from \Drupal\workspaces\EntityTypeInfo::entityTypeAlter() into Content Moderation.
Remaining tasks
TBD.
User interface changes
Nope.
API changes
Nope.
Data model changes
Nope.
Release notes snippet
Nope.
Comments