You are here

DataDefinitionUndefinedNormalizer.php in JSON:API Schema 8

File

src/Normalizer/DataDefinitionUndefinedNormalizer.php
View source
<?php

namespace Drupal\jsonapi_schema\Normalizer;

use Drupal\Core\TypedData\DataDefinitionInterface;

/**
 * Data definition normalizer.
 */
class DataDefinitionUndefinedNormalizer extends DataDefinitionNormalizer {

  /**
   * {@inheritdoc}
   */
  protected $supportedDataTypes = [
    'undefined',
  ];

  /**
   * {@inheritdoc}
   */
  protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
    return isset($context['name']) ? (object) [
      'title' => $context['name'],
    ] : (object) [];
  }

}

Classes

Namesort descending Description
DataDefinitionUndefinedNormalizer Data definition normalizer.