Unverified Commit aa003662 authored by larowlan's avatar larowlan

Issue #3032548 by Sam152: ContentModerationRouteSubscriber assumes all...

Issue #3032548 by Sam152: ContentModerationRouteSubscriber assumes all parameters in an entity form route contain a 'type' key
parent c52175dd
......@@ -71,7 +71,7 @@ protected function setLatestRevisionFlag(Route $route) {
}
$parameters = $route->getOption('parameters') ?: [];
foreach ($parameters as &$parameter) {
if ($parameter['type'] === 'entity:' . $entity_type && !isset($parameter['load_latest_revision'])) {
if (isset($parameter['type']) && $parameter['type'] === 'entity:' . $entity_type && !isset($parameter['load_latest_revision'])) {
$parameter['load_latest_revision'] = TRUE;
}
}
......
......@@ -187,6 +187,28 @@ public function setLatestRevisionFlagTestCases() {
],
],
],
'Parameter without type is unchanged' => [
[
'_entity_form' => 'entity_test_rev.edit',
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
],
'unrelated_param' => [
'foo' => 'bar',
],
],
[
'entity_test_rev' => [
'type' => 'entity:entity_test_rev',
'load_latest_revision' => TRUE,
],
'unrelated_param' => [
'foo' => 'bar',
],
],
],
];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment