@@ -6,50 +6,54 @@ namespace Drupal\{{ machine_name }}\Entity;
6
6
7
7
{% apply sort_namespaces % }
8
8
use Drupal\Core\Config\Entity\ConfigEntityBase ;
9
+ use Drupal\Core\Entity\Attribute\ConfigEntityType ;
10
+ use Drupal\Core\Entity\EntityDeleteForm ;
11
+ use Drupal\Core\StringTranslation\TranslatableMarkup ;
9
12
use Drupal\{{ machine_name }}\{{ class_prefix }}Interface ;
13
+ use Drupal\{{ machine_name }}\{{ class_prefix }}ListBuilder ;
14
+ use Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form ;
10
15
{% endapply % }
11
16
12
17
/**
13
18
* Defines the {{ entity_type_label|lower }} entity type.
14
- *
15
- * @ConfigEntityType(
16
- * id = "{{ entity_type_id }}",
17
- * label = @Translation("{{ entity_type_label }}"),
18
- * label_collection = @Translation("{{ entity_type_label|pluralize }}"),
19
- * label_singular = @Translation("{{ entity_type_label|lower }}"),
20
- * label_plural = @Translation("{{ entity_type_label|pluralize|lower }}"),
21
- * label_count = @PluralTranslation(
22
- * singular = "@count {{ entity_type_label|lower }}",
23
- * plural = "@count {{ entity_type_label|pluralize|lower }}",
24
- * ),
25
- * handlers = {
26
- * "list_builder" = "Drupal\{{ machine_name }}\{{ class_prefix }}ListBuilder",
27
- * "form" = {
28
- * "add" = "Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form",
29
- * "edit" = "Drupal\{{ machine_name }}\Form\{{ class_prefix }}Form",
30
- * "delete" = "Drupal\Core\Entity\EntityDeleteForm",
31
- * },
32
- * },
33
- * config_prefix = "{{ entity_type_id }}",
34
- * admin_permission = "administer {{ entity_type_id }}",
35
- * links = {
36
- * "collection" = "/admin/structure/{{ entity_type_id|u2h }}",
37
- * "add-form" = "/admin/structure/{{ entity_type_id|u2h }}/add",
38
- * "edit-form" = "/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}",
39
- * "delete-form" = "/admin/structure/{{ entity_type_id|u2h }}/{{ '{' }}{{ entity_type_id }}{{ '}' }}/delete",
40
- * },
41
- * entity_keys = {
42
- * "id" = "id",
43
- * "label" = "label",
44
- * "uuid" = "uuid",
45
- * },
46
- * config_export = {
47
- * "id",
48
- * "label",
49
- * "description",
50
- * },
51
- * )
52
19
*/
20
+ # [ConfigEntityType(
21
+ id : ' {{ entity_type_id }}' ,
22
+ label : new TranslatableMarkup (' {{ entity_type_label }}' ),
23
+ label_collection : new TranslatableMarkup (' {{ entity_type_label|pluralize }}' ),
24
+ label_singular : new TranslatableMarkup (' {{ entity_type_label|lower }}' ),
25
+ label_plural : new TranslatableMarkup (' {{ entity_type_label|pluralize|lower }}' ),
26
+ config_prefix : ' {{ entity_type_id }}' ,
27
+ entity_keys : [
28
+ ' id' => ' id' ,
29
+ ' label' => ' label' ,
30
+ ' uuid' => ' uuid' ,
31
+ ],
32
+ handlers : [
33
+ ' list_builder' => {{ class_prefix }}ListBuilder :: class ,
34
+ ' form' => [
35
+ ' add' => {{ class_prefix }}Form :: class ,
36
+ ' edit' => {{ class_prefix }}Form :: class ,
37
+ ' delete' => EntityDeleteForm :: class ,
38
+ ],
39
+ ],
40
+ links : [
41
+ ' collection' => ' /admin/structure/{{ entity_type_id|u2h }}' ,
42
+ ' add-form' => ' /admin/structure/{{ entity_type_id|u2h }}/add' ,
43
+ ' edit-form' => ' /admin/structure/{{ entity_type_id|u2h }}/{{ ' {' }}{{ entity_type_id }}{{ ' }' }}' ,
44
+ ' delete-form' => ' /admin/structure/{{ entity_type_id|u2h }}/{{ ' {' }}{{ entity_type_id }}{{ ' }' }}/delete' ,
45
+ ],
46
+ admin_permission : ' administer {{ entity_type_id }}' ,
47
+ label_count : [
48
+ ' singular' => ' @count {{ entity_type_label|lower }}' ,
49
+ ' plural' => ' @count {{ entity_type_label|pluralize|lower }}' ,
50
+ ],
51
+ config_export : [
52
+ ' id' ,
53
+ ' label' ,
54
+ ' description' ,
55
+ ],
56
+ )]
53
57
final class {{ class_prefix }} extends ConfigEntityBase implements {{ class_prefix }}Interface {
54
58
55
59
/**
0 commit comments