TypedDataInternalPropertiesHelper.php 686 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Drupal\Core\TypedData;
  3. /**
  4. * Helper class for internal properties.
  5. */
  6. class TypedDataInternalPropertiesHelper {
  7. /**
  8. * Gets an array non-internal properties from a complex data object.
  9. *
  10. * @param \Drupal\Core\TypedData\ComplexDataInterface $data
  11. * The complex data object.
  12. *
  13. * @return \Drupal\Core\TypedData\TypedDataInterface[]
  14. * The non-internal properties, keyed by property name.
  15. */
  16. public static function getNonInternalProperties(ComplexDataInterface $data) {
  17. return array_filter($data->getProperties(TRUE), function (TypedDataInterface $property) {
  18. return !$property->getDataDefinition()->isInternal();
  19. });
  20. }
  21. }