forked from hechoendrupal/drupal-console
/
entity.php.twig
68 lines (63 loc) · 1.92 KB
/
entity.php.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{% 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 %}
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\{{ module }}\{{ entity_class }}Interface;
{% 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 ConfigEntityBundleBase implements {{ entity_class }}Interface {% endblock %}
{% block class_methods %}
/**
* The {{ label }} ID.
*
* @var string
*/
protected $id;
/**
* The {{ label }} label.
*
* @var string
*/
protected $label;
{% endblock %}