You are here

protected function SyncCoreEntityItemResource::respondWith in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 2.1.x src/Plugin/rest/resource/SyncCoreEntityItemResource.php \Drupal\cms_content_sync\Plugin\rest\resource\SyncCoreEntityItemResource::respondWith()
2 calls to SyncCoreEntityItemResource::respondWith()
SyncCoreEntityItemResource::get in src/Plugin/rest/resource/SyncCoreEntityItemResource.php
SyncCoreEntityItemResource::handleIncomingEntity in src/Plugin/rest/resource/SyncCoreEntityItemResource.php

File

src/Plugin/rest/resource/SyncCoreEntityItemResource.php, line 222

Class

SyncCoreEntityItemResource
Provides entity interfaces for Content Sync, allowing Sync Core v2 to request and manipulate entities.

Namespace

Drupal\cms_content_sync\Plugin\rest\resource

Code

protected function respondWith($body, $status, $serialize = false) {
  $response = new ModifiedResourceResponse($serialize ? null : $body, $status);
  if ($serialize) {
    $response
      ->setContent(json_encode($body));
  }
  return $response;
}