public function FileEntityNormalizer::supportsDenormalization in Replication 8
Same name and namespace in other branches
- 8.2 src/Normalizer/FileEntityNormalizer.php \Drupal\replication\Normalizer\FileEntityNormalizer::supportsDenormalization()
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.
Overrides NormalizerBase::supportsDenormalization
File
- src/
Normalizer/ FileEntityNormalizer.php, line 100
Class
Namespace
Drupal\replication\NormalizerCode
public function supportsDenormalization($data, $type, $format = NULL) {
// We need to accept both FileInterface and ContentEntityInterface classes.
// File entities are treated as standard content entities.
if (in_array($type, [
'Drupal\\Core\\Entity\\ContentEntityInterface',
'Drupal\\file\\FileInterface',
], TRUE)) {
// If a document has _attachment then we assume it's a file entity.
if (!empty($data['@attachment'])) {
return TRUE;
}
}
return FALSE;
}