If I add content moderation to an entity that has a form mode enabled, clear cache will show the following error:
Notice: Undefined index: type in Drupal\content_moderation\Routing\ContentModerationRouteSubscriber->setLatestRevisionFlag() (line 74 of core/modules/content_moderation/src/Routing/ContentModerationRouteSubscriber.php).
The function setLatestRevisionFlag()
in Drupal\content_moderation\Routing\ContentModerationRouteSubscriber
assumes that the default entity form will always have the entity type in$parameter['type']
.
However the form mode of an entity has the entity type in $parameter['targetEntityType']
instead.
More specifically, if I replace
if ($parameter['type'] === 'entity:' . $entity_type && !isset($parameter['load_latest_revision'])) {
$parameter['load_latest_revision'] = TRUE;
}
with
if (isset($parameter['type']) && $parameter['type'] === 'entity:' . $entity_type && !isset($parameter['load_latest_revision'])) {
$parameter['load_latest_revision'] = TRUE;
}
elseif (isset($parameter['targetEntityType']) && $parameter['targetEntityType'] === $entity_type) {
$parameter['type'] = 'entity:' . $entity_type;
$parameter['load_latest_revision'] = TRUE;
}
apparently all will work fine, but I'm not sure if this is a robust solution.
Postponed: needs info
9.5
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.