From 8aadf29fbf8587e26f37644a65c22d59c5137968 Mon Sep 17 00:00:00 2001 From: Kirstien Kroeger Date: Mon, 1 Apr 2024 16:01:31 -0500 Subject: [PATCH] Update ItemAPI.php --- code/web/services/API/ItemAPI.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/web/services/API/ItemAPI.php b/code/web/services/API/ItemAPI.php index 647e5142d6..adb8d0edc5 100644 --- a/code/web/services/API/ItemAPI.php +++ b/code/web/services/API/ItemAPI.php @@ -1166,10 +1166,19 @@ function getVariations() { /** @var File_MARC_Control_Field $oclcNumber */ $oclcNumber = $relatedRecordDriver->getOCLCNumber(); + $actionButtons = []; + $actions = $relatedVariation->getActions(); + foreach ($actions as $key => $action) { + $actionButtons[$key]['id'] = $action['id'] . '_' . $key; + $actionButtons[$key]['type'] = $action['type']; + $actionButtons[$key]['title'] = $action['title']; + $actionButtons[$key]['requireLogin'] = $action['requireLogin']; + } + $variations[$relatedVariation->label]['id'] = $relatedRecord->id; $variations[$relatedVariation->label]['source'] = $relatedRecord->source; $variations[$relatedVariation->label]['closedCaptioned'] = (int) $relatedRecord->closedCaptioned; - $variations[$relatedVariation->label]['actions'] = $relatedVariation->getActions(); + $variations[$relatedVariation->label]['actions'] = $actionButtons; $variations[$relatedVariation->label]['variationId'] = $relatedVariation->databaseId; $variations[$relatedVariation->label]['holdType'] = $holdType; $variations[$relatedVariation->label]['statusIndicator'] = [