I work on custom Entity integration with Revisions diff.
buildRevisionData does next check:
$route_name = $entity_type_id != 'node' ? "entity.$entity_type_id.revisions_diff" : 'entity.node.revision';
But, "entity.$entity_type_id.revisions_diff" route requires additional three params: $left_revision, $right_revision, $filter.
Obviously, it breaks on render. With message:
Some mandatory parameters are missing ("left_revision", "right_revision", "filter") to generate a URL for route "entity.super_order.revisions_diff". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 180 of core/lib/Drupal/Core/Routing/UrlGenerator.php).
Problem is in next code:
$revision_link['date'] = [
'#type' => 'link',
'#title' => $this->date->format($revision->getRevisionCreationTime(), 'short'),
'#url' => Url::fromRoute($route_name, [
$entity_type_id => $revision->id(),
$entity_type_id . '_revision' => $revision->getRevisionId(),
]),
'#prefix' => '<div class="diff-revision__item diff-revision__item-date">',
'#suffix' => '</div>',
];
Suggestion is to replace
"entity.$entity_type_id.revisions_diff"
with
"entity.$entity_type_id.revision"
route.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | diff-fixes_revision_route_in_buildRevisionData-2869752-3.patch | 1.75 KB | profak |
| #2 | diff-fixes_revision_route_in_buildRevisionData-2869752-1.patch | 1.04 KB | profak |
Comments
Comment #2
profak commentedPatch attached. Please review.
Comment #4
profak commentedNew patch fixes same issue with other plugins.
Test coverage fails even without patch.