Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / Entity / entity.php.twig
diff --git a/vendor/drupal/console/templates/module/src/Entity/entity.php.twig b/vendor/drupal/console/templates/module/src/Entity/entity.php.twig
new file mode 100644 (file)
index 0000000..07d85f2
--- /dev/null
@@ -0,0 +1,71 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{ module }}\Entity\{{ entity_class }}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{ module }}\Entity;
+{% endblock %}
+
+{% block use_class %}
+{% if bundle_of %}
+use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
+{% else %}
+use Drupal\Core\Config\Entity\ConfigEntityBase;
+{% endif %}
+{% endblock %}
+
+{% block class_declaration %}
+/**
+ * Defines the {{ label }} entity.
+ *
+ * @ConfigEntityType(
+ *   id = "{{ entity_name }}",
+ *   label = @Translation("{{ label }}"),
+ *   handlers = {
+ *     "list_builder" = "Drupal\{{ module }}\{{ entity_class }}ListBuilder",
+ *     "form" = {
+ *       "add" = "Drupal\{{ module }}\Form\{{ entity_class }}Form",
+ *       "edit" = "Drupal\{{ module }}\Form\{{ entity_class }}Form",
+ *       "delete" = "Drupal\{{ module }}\Form\{{ entity_class }}DeleteForm"
+ *     },
+ *     "route_provider" = {
+ *       "html" = "Drupal\{{ module }}\{{ entity_class }}HtmlRouteProvider",
+ *     },
+ *   },
+ *   config_prefix = "{{ entity_name }}",
+ *   admin_permission = "administer site configuration",
+{% if bundle_of %}
+ *   bundle_of = "{{ bundle_of }}",
+{% endif %}
+ *   entity_keys = {
+ *     "id" = "id",
+ *     "label" = "label",
+ *     "uuid" = "uuid"
+ *   },
+ *   links = {
+ *     "canonical" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}",
+ *     "add-form" = "{{ base_path }}/{{ entity_name }}/add",
+ *     "edit-form" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/edit",
+ *     "delete-form" = "{{ base_path }}/{{ entity_name }}/{{ '{'~entity_name~'}' }}/delete",
+ *     "collection" = "{{ base_path }}/{{ entity_name }}"
+ *   }
+ * )
+ */
+class {{ entity_class }} extends {% if bundle_of %}ConfigEntityBundleBase{% else %}ConfigEntityBase{% endif %} implements {{ entity_class }}Interface {% endblock %}
+{% block class_methods %}
+  /**
+   * The {{ label }} ID.
+   *
+   * @var string
+   */
+  protected $id;
+
+  /**
+   * The {{ label }} label.
+   *
+   * @var string
+   */
+  protected $label;
+{% endblock %}