mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-29 10:05:03 +00:00
Enhance version restoration and download features
Introduce a version restoration button and logic to track restored versions throughout the UI. Update download buttons to display action strings conditionally and implement toast notifications for version restoration.
This commit is contained in:
@@ -24,6 +24,8 @@ class StoredObjectVersionNormalizer implements NormalizerInterface, NormalizerAw
|
||||
|
||||
final public const WITH_POINT_IN_TIMES_CONTEXT = 'with-point-in-times';
|
||||
|
||||
final public const WITH_RESTORED_CONTEXT = 'with-restored';
|
||||
|
||||
public function normalize($object, ?string $format = null, array $context = [])
|
||||
{
|
||||
if (!$object instanceof StoredObjectVersion) {
|
||||
@@ -45,6 +47,10 @@ class StoredObjectVersionNormalizer implements NormalizerInterface, NormalizerAw
|
||||
$data['point-in-times'] = $this->normalizer->normalize($object->getPointInTimes(), $format, $context);
|
||||
}
|
||||
|
||||
if (in_array(self::WITH_RESTORED_CONTEXT, $context[AbstractNormalizer::GROUPS] ?? [], true)) {
|
||||
$data['from-restored'] = $this->normalizer->normalize($object->getCreatedFrom(), $format, [AbstractNormalizer::GROUPS => ['read']]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user