Added missing modules, including some as submodules.
[yaffs-website] / web / modules / contrib / environment_indicator / src / Entity / EnvironmentIndicator.php
1 <?php
2
3 namespace Drupal\environment_indicator\Entity;
4
5 use Drupal\Core\Config\Entity\ConfigEntityBase;
6 use Drupal\Core\Config\Entity\ConfigEntityInterface;
7 use Drupal\Core\Entity\Annotation\EntityType;
8 use Drupal\Core\Annotation\Translation;
9
10 /**
11  * Defines a Environment configuration entity.
12  *
13  * @ConfigEntityType(
14  *   id = "environment_indicator",
15  *   label = @Translation("Environment Switcher"),
16  *   handlers = {
17  *     "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage",
18  *     "access" = "Drupal\environment_indicator\EnvironmentIndicatorAccessControlHandler",
19  *     "list_builder" = "Drupal\environment_indicator\EnvironmentIndicatorListBuilder",
20  *     "form" = {
21  *       "default" = "Drupal\environment_indicator\EnvironmentIndicatorForm",
22  *       "delete" = "Drupal\Core\Entity\EntityDeleteForm"
23  *     }
24  *   },
25  *   admin_permission = "administer environment indicator settings",
26  *   config_prefix = "switcher",
27  *   static_cache = TRUE,
28  *   entity_keys = {
29  *     "id" = "machine",
30  *     "label" = "human_name",
31  *     "weight" = "weight"
32  *   },
33  *   links = {
34  *     "edit-form" = "/admin/config/development/environment-indicator/manage/{environment_indicator}",
35  *     "edit-permissions-form" = "/admin/people/permissions/{user_role}",
36  *     "delete-form" = "/admin/config/development/environment-indicator/manage/{environment_indicator}/delete",
37  *     "collection" = "/admin/config/development/environment-indicator"
38  *   }
39  * )
40  */
41 class EnvironmentIndicator extends ConfigEntityBase implements ConfigEntityInterface {
42
43   /**
44    * The machine-readable ID for the configurable.
45    *
46    * @var string
47    */
48   public $machine;
49
50   /**
51    * The human-readable label for the configurable.
52    *
53    * @var string
54    */
55   public $name;
56
57   /**
58    * The URL to switch to.
59    *
60    * @var string
61    */
62   public $url;
63
64   /**
65    * The color code for the indicator.
66    *
67    * @var string
68    */
69   public $fg_color;
70
71   /**
72    * The color code for the indicator.
73    *
74    * @var string
75    */
76   public $bg_color;
77
78
79   /**
80    * {@inheritdoc}
81    */
82   public function id() {
83     return $this->get('machine');
84   }
85
86   /**
87    * {@inheritdoc}
88    */
89   public function label($langcode = NULL) {
90     return $this->get('name');
91   }
92
93   /**
94    * Gets the URL.
95    *
96    * @return string
97    */
98   public function getUrl() {
99     return $this->get('url');
100   }
101
102   /**
103    * Gets the foreground color.
104    *
105    * @return string
106    */
107   public function getFgColor() {
108     return $this->get('fg_color');
109   }
110
111   /**
112    * Gets the background color.
113    *
114    * @return string
115    */
116   public function getBgColor() {
117     return $this->get('bg_color');
118   }
119
120   /**
121    * Gets the machine name.
122    *
123    * @param string $machine
124    */
125   public function setMachine($machine) {
126     $this->set('machine', $machine);
127   }
128
129   /**
130    * Sets the name.
131    *
132    * @param string $name
133    */
134   public function setName($name) {
135     $this->set('name', $name);
136   }
137
138   /**
139    * Sets the URL.
140    *
141    * @param string $url
142    */
143   public function setUrl($url) {
144     $this->set('url', $url);
145   }
146
147   /**
148    * Sets the foreground color.
149    *
150    * @param string $fg_color
151    */
152   public function setFgColor($fg_color) {
153     $this->set('fg_color', $fg_color);
154   }
155
156   /**
157    * Sets the background color.
158    *
159    * @param string $bg_color
160    */
161   public function setBgColor($bg_color) {
162     $this->set('bg_color', $bg_color);
163   }
164
165 }