From c8873f85372acdce2e02749acdf7d795ecea2170 Mon Sep 17 00:00:00 2001 From: Bozana Bokan Date: Wed, 21 Aug 2024 11:47:42 +0200 Subject: [PATCH] pkp/pkp-lib#10329 Include metadataLocales in /submissions/{submissionId} API --- classes/submission/maps/Schema.php | 5 +++++ schemas/submission.json | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/classes/submission/maps/Schema.php b/classes/submission/maps/Schema.php index 0ba29a17e1e..c02e101eae9 100644 --- a/classes/submission/maps/Schema.php +++ b/classes/submission/maps/Schema.php @@ -358,6 +358,11 @@ protected function mapByProperties(array $props, Submission $submission, bool|Co case 'editorAssigned': $output[$prop] = $this->getPropertyStageAssignments($this->stageAssignments); break; + case 'metadataLocales': + $output[$prop] = collect($this->context->getSupportedSubmissionMetadataLocaleNames() + $submission->getPublicationLanguageNames()) + ->sortKeys() + ->toArray(); + break; case 'publications': $output[$prop] = Repo::publication()->getSchemaMap($submission, $this->userGroups, $this->genres) ->summarizeMany($submission->getData('publications'), $anonymize)->values(); diff --git a/schemas/submission.json b/schemas/submission.json index eaae69ee174..ea9cae2b9fa 100644 --- a/schemas/submission.json +++ b/schemas/submission.json @@ -77,6 +77,14 @@ "regex:/^([A-Za-z]{2,4})(?[_-]([A-Za-z]{4,5}|[0-9]{4}))?([_-]([A-Za-z]{2}|[0-9]{3}))?(@[a-z]{2,30}(?&sc)?)?$/" ] }, + "metadataLocales": { + "type": "array", + "description": "The list of metadata locales in the form [locale code => locale name translated in UI locale].", + "readOnly": true, + "items": { + "type": "string" + } + }, "publications": { "type": "array", "description": "A list of publications that have been created for this submission.",