Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / entity / src / BundleFieldDefinition.php
diff --git a/web/modules/contrib/entity/src/BundleFieldDefinition.php b/web/modules/contrib/entity/src/BundleFieldDefinition.php
new file mode 100644 (file)
index 0000000..9da74c8
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\entity;
+
+use Drupal\Core\Field\BaseFieldDefinition;
+
+/**
+ * Provides a field definition class for bundle fields.
+ *
+ * Core currently doesn't provide one, the hook_entity_bundle_field_info()
+ * example uses BaseFieldDefinition, which is wrong. Tracked in #2346347.
+ *
+ * Note that this class implements both FieldStorageDefinitionInterface and
+ * FieldDefinitionInterface. This is a simplification for DX reasons,
+ * allowing code to return just the bundle definitions instead of having to
+ * return both storage definitions and bundle definitions.
+ */
+class BundleFieldDefinition extends BaseFieldDefinition {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function isBaseField() {
+    return FALSE;
+  }
+
+}