ContentEntityNormalizer.php in Zircon Profile 8
File
core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php
View source
<?php
namespace Drupal\serialization\Normalizer;
class ContentEntityNormalizer extends EntityNormalizer {
protected $supportedInterfaceOrClass = [
'Drupal\\Core\\Entity\\ContentEntityInterface',
];
public function normalize($object, $format = NULL, array $context = array()) {
$context += array(
'account' => NULL,
);
$attributes = [];
foreach ($object as $name => $field) {
if ($field
->access('view', $context['account'])) {
$attributes[$name] = $this->serializer
->normalize($field, $format, $context);
}
}
return $attributes;
}
}