diff --git a/controller/ItemResultPreviewer.php b/controller/ItemResultPreviewer.php index 6457842..704f671 100755 --- a/controller/ItemResultPreviewer.php +++ b/controller/ItemResultPreviewer.php @@ -1,4 +1,5 @@ defaultData(); $data['type'] = $this->getItemResultPreviewerType($resultIdentifier); $data['content'] = $this->getItemContent($itemDefinition, $resultIdentifier, $delivery->getUri()); - $data['state'] = current($this->getItemResultVariables($delivery, $resultIdentifier, $itemDefinition) ?? []); + $data['state'] = current($this->getItemResultVariables( + $delivery, $resultIdentifier, $itemDefinition) ?? + [] + ); $data['itemDefinition'] = $itemDefinition; $data['resultIdentifier'] = $resultIdentifier; $data['deliveryIdentifier'] = $delivery->getUri(); @@ -124,8 +128,10 @@ public function preview() */ protected function getItemResultPreviewerType($resultIdentifier) { - return $this->getServiceLocator()->get(ResultsViewerService::SERVICE_ID) - ->getDeliveryItemType($resultIdentifier); + /** @var DeliveryItemTypeRepository $deliveryItemTypeRepository */ + $deliveryItemTypeRepository = $this->getServiceLocator()->get(DeliveryItemTypeRepository::SERVICE_ID); + + return $deliveryItemTypeRepository->getDeliveryItemType($resultIdentifier); } /** @@ -230,7 +236,9 @@ protected function getItemVariable($delivery, $resultIdentifier, $itemDefinition { if (!isset($this->itemVariables[$itemDefinition])) { $variables = $this->getDeliveryResultsService($delivery)->getStructuredVariables( - $resultIdentifier, ResultsService::VARIABLES_FILTER_ALL, [\taoResultServer_models_classes_ResponseVariable::class] + $resultIdentifier, + ResultsService::VARIABLES_FILTER_ALL, + [\taoResultServer_models_classes_ResponseVariable::class] ); $itemVariables = [];