You are here

FallbackTypeMapper.php in Schemata 8

File

schemata_json_schema/src/Plugin/schemata_json_schema/type_mapper/FallbackTypeMapper.php
View source
<?php

namespace Drupal\schemata_json_schema\Plugin\schemata_json_schema\type_mapper;

use Drupal\Core\TypedData\DataDefinitionInterface;

/**
 * The fallback type mapper, explicitly called if none other is applicable.
 *
 * @TypeMapper(
 *  id = "fallback"
 * )
 */
class FallbackTypeMapper extends TypeMapperBase {

  /**
   * {@inheritdoc}
   */
  public function getMappedValue(DataDefinitionInterface $property) {
    $value = parent::getMappedValue($property);
    $value['type'] = $property
      ->getDataType();
    return $value;
  }

}

Classes

Namesort descending Description
FallbackTypeMapper The fallback type mapper, explicitly called if none other is applicable.