Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / pathauto / tests / modules / pathauto_string_id_test / src / Entity / PathautoStringIdTest.php
diff --git a/web/modules/contrib/pathauto/tests/modules/pathauto_string_id_test/src/Entity/PathautoStringIdTest.php b/web/modules/contrib/pathauto/tests/modules/pathauto_string_id_test/src/Entity/PathautoStringIdTest.php
new file mode 100644 (file)
index 0000000..afaa157
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+namespace Drupal\pathauto_string_id_test\Entity;
+
+use Drupal\Core\Entity\ContentEntityBase;
+use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Core\Field\BaseFieldDefinition;
+
+/**
+ * Defines a test entity with a string ID.
+ *
+ * @ContentEntityType(
+ *   id = "pathauto_string_id_test",
+ *   label = @Translation("Test entity with string ID"),
+ *   handlers = {
+ *     "route_provider" = {
+ *       "html" = "Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider",
+ *     },
+ *   },
+ *   base_table = "pathauto_string_id_test",
+ *   entity_keys = {
+ *     "id" = "id",
+ *     "label" = "name",
+ *   },
+ *   links = {
+ *     "canonical" = "/pathauto_string_id_test/{pathauto_string_id_test}",
+ *   },
+ * )
+ */
+class PathautoStringIdTest extends ContentEntityBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
+    $fields['id'] = BaseFieldDefinition::create('string')
+      ->setLabel('ID')
+      ->setReadOnly(TRUE)
+      // A bigger value will not be allowed to build the index.
+      ->setSetting('max_length', 191);
+    $fields['name'] = BaseFieldDefinition::create('string')
+      ->setLabel('Name');
+    $fields['path'] = BaseFieldDefinition::create('path')
+      ->setLabel('Path')
+      ->setComputed(TRUE);
+
+    return $fields;
+  }
+
+}