e8978520bcafecdcb4de5e84a501e02de9ce4e1d
[yaffs-website] / web / core / modules / comment / src / Entity / CommentType.php
1 <?php
2
3 namespace Drupal\comment\Entity;
4
5 use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
6 use Drupal\comment\CommentTypeInterface;
7
8 /**
9  * Defines the comment type entity.
10  *
11  * @ConfigEntityType(
12  *   id = "comment_type",
13  *   label = @Translation("Comment type"),
14  *   label_singular = @Translation("comment type"),
15  *   label_plural = @Translation("comment types"),
16  *   label_count = @PluralTranslation(
17  *     singular = "@count comment type",
18  *     plural = "@count comment types",
19  *   ),
20  *   handlers = {
21  *     "form" = {
22  *       "default" = "Drupal\comment\CommentTypeForm",
23  *       "add" = "Drupal\comment\CommentTypeForm",
24  *       "edit" = "Drupal\comment\CommentTypeForm",
25  *       "delete" = "Drupal\comment\Form\CommentTypeDeleteForm"
26  *     },
27  *     "list_builder" = "Drupal\comment\CommentTypeListBuilder"
28  *   },
29  *   admin_permission = "administer comment types",
30  *   config_prefix = "type",
31  *   bundle_of = "comment",
32  *   entity_keys = {
33  *     "id" = "id",
34  *     "label" = "label"
35  *   },
36  *   links = {
37  *     "delete-form" = "/admin/structure/comment/manage/{comment_type}/delete",
38  *     "edit-form" = "/admin/structure/comment/manage/{comment_type}",
39  *     "add-form" = "/admin/structure/comment/types/add",
40  *     "collection" = "/admin/structure/comment",
41  *   },
42  *   config_export = {
43  *     "id",
44  *     "label",
45  *     "target_entity_type_id",
46  *     "description",
47  *   }
48  * )
49  */
50 class CommentType extends ConfigEntityBundleBase implements CommentTypeInterface {
51
52   /**
53    * The comment type ID.
54    *
55    * @var string
56    */
57   protected $id;
58
59   /**
60    * The comment type label.
61    *
62    * @var string
63    */
64   protected $label;
65
66   /**
67    * The description of the comment type.
68    *
69    * @var string
70    */
71   protected $description;
72
73   /**
74    * The target entity type.
75    *
76    * @var string
77    */
78   protected $target_entity_type_id;
79
80   /**
81    * {@inheritdoc}
82    */
83   public function getDescription() {
84     return $this->description;
85   }
86
87   /**
88    * {@inheritdoc}
89    */
90   public function setDescription($description) {
91     $this->description = $description;
92     return $this;
93   }
94
95   /**
96    * {@inheritdoc}
97    */
98   public function getTargetEntityTypeId() {
99     return $this->target_entity_type_id;
100   }
101
102 }