You are here

public function RenderNormalizer::normalize in REST Views 8

Same name and namespace in other branches
  1. 2.0.x src/Normalizer/RenderNormalizer.php \Drupal\rest_views\Normalizer\RenderNormalizer::normalize()

Throws

\Exception

File

src/Normalizer/RenderNormalizer.php, line 45

Class

RenderNormalizer
Unwrap a RenderableData object and render the element inside.

Namespace

Drupal\rest_views\Normalizer

Code

public function normalize($object, $format = NULL, array $context = []) {

  /** @var \Drupal\rest_views\SerializedData $object */

  /** @var \Symfony\Component\Serializer\Normalizer\NormalizerInterface $normalizer */
  $normalizer = $this->serializer;
  $data = $object
    ->getData();
  return $normalizer
    ->normalize($this->renderer
    ->render($data));
}