Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / TypedData / TypedDataInternalPropertiesHelper.php
diff --git a/web/core/lib/Drupal/Core/TypedData/TypedDataInternalPropertiesHelper.php b/web/core/lib/Drupal/Core/TypedData/TypedDataInternalPropertiesHelper.php
new file mode 100644 (file)
index 0000000..a9a59d7
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace Drupal\Core\TypedData;
+
+/**
+ * Helper class for internal properties.
+ */
+class TypedDataInternalPropertiesHelper {
+
+  /**
+   * Gets an array non-internal properties from a complex data object.
+   *
+   * @param \Drupal\Core\TypedData\ComplexDataInterface $data
+   *   The complex data object.
+   *
+   * @return \Drupal\Core\TypedData\TypedDataInterface[]
+   *   The non-internal properties, keyed by property name.
+   */
+  public static function getNonInternalProperties(ComplexDataInterface $data) {
+    return array_filter($data->getProperties(TRUE), function (TypedDataInterface $property) {
+      return !$property->getDataDefinition()->isInternal();
+    });
+  }
+
+}