public function AttachmentNormalizer::normalize in Replication 8
Same name and namespace in other branches
- 8.2 src/Normalizer/AttachmentNormalizer.php \Drupal\replication\Normalizer\AttachmentNormalizer::normalize()
Overrides ContentEntityNormalizer::normalize
File
- src/
Normalizer/ AttachmentNormalizer.php, line 24
Class
Namespace
Drupal\replication\NormalizerCode
public function normalize($data, $format = NULL, array $context = []) {
// If the 'new_revision_id' context is TRUE then normalize file entity as a
// content entity not stream.
if (!empty($context['new_revision_id'])) {
return parent::normalize($data, $format, $context);
}
/** @var \Drupal\file\FileInterface $data */
$stream = fopen($data
->getFileUri(), 'r');
return $stream;
}