/** * {@inheritdoc} */ public function normalize($price, $format = null, array $context = []) { $price = $this->priceNormalizer->normalize($price, $format, $context); foreach ($price as $currency => $data) { $price[$currency] = $this->localizer->convertDefaultToLocalized($data, $context); } return $price; }
/** * {@inheritdoc} */ public function normalize($metric, $format = null, array $context = []) { $metric = $this->metricNormalizer->normalize($metric, $format, $context); if (!isset($context['field_name']) || !isset($metric[$context['field_name']])) { return $metric; } $metric[$context['field_name']] = $this->localizer->convertDefaultToLocalized($metric[$context['field_name']], $context); return $metric; }
/** * {@inheritdoc} */ public function normalize($price, $format = null, array $context = []) { $price = $this->priceNormalizer->normalize($price, $format, $context); foreach ($price as $currency => $data) { $formattedPrice = [['currency' => $currency, 'data' => $data]]; $localizedPrice = $this->localizer->convertDefaultToLocalized($formattedPrice, $context); $price[$currency] = $localizedPrice[0]['data']; } return $price; }
/** * {@inheritdoc} */ public function normalize($entity, $format = null, array $context = []) { $result = $this->valuesNormalizer->normalize($entity, $format, $context); if (AttributeTypes::NUMBER === $entity->getAttribute()->getAttributeType()) { foreach ($result as $field => $data) { $result[$field] = $this->localizer->convertDefaultToLocalized($data, $context); } } return $result; }