Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
ContactDetailType
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 isLocked
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDescription
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setDescription
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\crm\Entity;
6
7use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
8use Drupal\crm\CrmContactDetailTypeInterface;
9
10/**
11 * Defines the CRM Contact Detail type configuration entity.
12 *
13 * @ConfigEntityType(
14 *   id = "crm_contact_detail_type",
15 *   label = @Translation("CRM Contact Detail type"),
16 *   label_collection = @Translation("CRM Contact Detail types"),
17 *   label_singular = @Translation("crm contact detail type"),
18 *   label_plural = @Translation("crm contact details types"),
19 *   label_count = @PluralTranslation(
20 *     singular = "@count crm contact details type",
21 *     plural = "@count crm contact details types",
22 *   ),
23 *   handlers = {
24 *     "access" = "Drupal\crm\ContactDetailTypeAccessControlHandler",
25 *     "form" = {
26 *       "add" = "Drupal\crm\Form\ContactDetailTypeForm",
27 *       "edit" = "Drupal\crm\Form\ContactDetailTypeForm",
28 *       "delete" = "Drupal\Core\Entity\EntityDeleteForm",
29 *     },
30 *     "list_builder" = "Drupal\crm\ContactDetailTypeListBuilder",
31 *     "route_provider" = {
32 *       "html" = "Drupal\Core\Entity\Routing\AdminHtmlRouteProvider",
33 *     },
34 *   },
35 *   admin_permission = "administer crm contact detail types",
36 *   bundle_of = "crm_contact_detail",
37 *   config_prefix = "crm_contact_detail_type",
38 *   entity_keys = {
39 *     "id" = "id",
40 *     "label" = "label",
41 *     "uuid" = "uuid",
42 *   },
43 *   links = {
44 *     "add-form" = "/admin/structure/crm/contact-detail-types/add",
45 *     "edit-form" = "/admin/structure/crm/contact-detail-types/manage/{crm_contact_detail_type}",
46 *     "delete-form" = "/admin/structure/crm/contact-detail-types/manage/{crm_contact_detail_type}/delete",
47 *     "collection" = "/admin/structure/crm/contact-detail-types",
48 *   },
49 *   config_export = {
50 *     "id",
51 *     "label",
52 *     "description",
53 *     "uuid",
54 *     "locked",
55 *   },
56 * )
57 */
58final class ContactDetailType extends ConfigEntityBundleBase implements CrmContactDetailTypeInterface {
59
60  /**
61   * The machine name of this crm contact detail type.
62   */
63  protected string $id;
64
65  /**
66   * The human-readable name of the crm contact detail type.
67   */
68  protected string $label;
69
70  /**
71   * The description of the crm contact detail type.
72   *
73   * @var string|null
74   */
75  protected ?string $description;
76
77  /**
78   * Whether the Contact Detail Type is locked.
79   */
80  protected bool $locked = FALSE;
81
82  /**
83   * Is the contact type locked?
84   */
85  public function isLocked(): bool {
86    return $this->locked;
87  }
88
89  /**
90   * {@inheritdoc}
91   */
92  public function getDescription() {
93    return $this->description ?? '';
94  }
95
96  /**
97   * {@inheritdoc}
98   */
99  public function setDescription($description) {
100    $this->description = $description;
101
102    return $this;
103  }
104
105}