public function Serializer::render

Render the display in this style.

Overrides StylePluginBase::render

File

drupal/core/modules/rest/lib/Drupal/rest/Plugin/views/style/Serializer.php, line 118
Contains \Drupal\rest\Plugin\views\style\Serializer.

Class

Serializer
The style plugin for serialized output formats.

Namespace

Drupal\rest\Plugin\views\style

Code

public function render() {
  $rows = array();

  // If the Data Entity row plugin is used, this will be an array of entities
  // which will pass through Serializer to one of the registered Normalizers,
  // which will transform it to arrays/scalars. If the Data field row plugin
  // is used, $rows will not contain objects and will pass directly to the
  // Encoder.
  foreach ($this->view->result as $row) {
    $rows[] = $this->view->rowPlugin
      ->render($row);
  }
  return $this->serializer
    ->serialize($rows, $this->displayHandler
    ->getContentType());
}