You are here

public function ParagraphNormalizer::supportsDenormalization in Replication 8

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/ParagraphNormalizer.php, line 81

Class

ParagraphNormalizer

Namespace

Drupal\replication\Normalizer

Code

public function supportsDenormalization($data, $type, $format = NULL) {
  if (in_array($type, [
    'Drupal\\paragraphs\\Entity\\Paragraph',
    'Drupal\\Core\\Entity\\ContentEntityInterface',
  ])) {
    if (isset($data['@type']) && $data['@type'] == 'paragraph') {
      return TRUE;
    }
  }
  return FALSE;
}