Add duplication feature for evaluation documents within generic doc

Introduced a new method to duplicate evaluation documents and forward return path URLs. Updated templates to include duplication buttons and adjusted routing for handling the duplication process.
This commit is contained in:
2024-11-06 19:04:12 +01:00
parent 9526d016c6
commit db4d7669f1
4 changed files with 52 additions and 3 deletions

View File

@@ -40,4 +40,15 @@ final readonly class ChillUrlGenerator implements ChillUrlGeneratorInterface
return $this->urlGenerator->generate($name, $parameters, $referenceType);
}
public function forwardReturnPath(string $name, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
{
$request = $this->requestStack->getCurrentRequest();
if ($request->query->has('returnPath')) {
return $this->urlGenerator->generate($name, [...$parameters, 'returnPath' => $request->query->get('returnPath')], $referenceType);
}
return $this->urlGenerator->generate($name, $parameters, $referenceType);
}
}

View File

@@ -32,4 +32,9 @@ interface ChillUrlGeneratorInterface
* Get the return path or, if any, generate an url.
*/
public function returnPathOr(string $name, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string;
/**
* Return a new URL, with the same return path as the existing one. If any, no return path is forwarded.
*/
public function forwardReturnPath(string $name, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string;
}