StringData.php 572 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Drupal\Core\TypedData\Plugin\DataType;
  3. use Drupal\Core\TypedData\PrimitiveBase;
  4. use Drupal\Core\TypedData\Type\StringInterface;
  5. /**
  6. * The string data type.
  7. *
  8. * The plain value of a string is a regular PHP string. For setting the value
  9. * any PHP variable that casts to a string may be passed.
  10. *
  11. * @DataType(
  12. * id = "string",
  13. * label = @Translation("String")
  14. * )
  15. */
  16. class StringData extends PrimitiveBase implements StringInterface {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public function getCastedValue() {
  21. return $this->getString();
  22. }
  23. }