Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/tour/src/TipPluginBase.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\tour; | |
4 | |
5 use Drupal\Core\Plugin\PluginBase; | |
6 | |
7 /** | |
8 * Defines a base tour item implementation. | |
9 * | |
10 * @see \Drupal\tour\Annotation\Tip | |
11 * @see \Drupal\tour\TipPluginInterface | |
12 * @see \Drupal\tour\TipPluginManager | |
13 * @see plugin_api | |
14 */ | |
15 abstract class TipPluginBase extends PluginBase implements TipPluginInterface { | |
16 | |
17 /** | |
18 * The label which is used for render of this tip. | |
19 * | |
20 * @var string | |
21 */ | |
22 protected $label; | |
23 | |
24 /** | |
25 * Allows tips to take more priority that others. | |
26 * | |
27 * @var string | |
28 */ | |
29 protected $weight; | |
30 | |
31 /** | |
32 * The attributes that will be applied to the markup of this tip. | |
33 * | |
34 * @var array | |
35 */ | |
36 protected $attributes; | |
37 | |
38 /** | |
39 * {@inheritdoc} | |
40 */ | |
41 public function id() { | |
42 return $this->get('id'); | |
43 } | |
44 | |
45 /** | |
46 * {@inheritdoc} | |
47 */ | |
48 public function getLabel() { | |
49 return $this->get('label'); | |
50 } | |
51 | |
52 /** | |
53 * {@inheritdoc} | |
54 */ | |
55 public function getWeight() { | |
56 return $this->get('weight'); | |
57 } | |
58 | |
59 /** | |
60 * {@inheritdoc} | |
61 */ | |
62 public function getAttributes() { | |
63 return $this->get('attributes') ?: []; | |
64 } | |
65 | |
66 /** | |
67 * {@inheritdoc} | |
68 */ | |
69 public function get($key) { | |
70 if (!empty($this->configuration[$key])) { | |
71 return $this->configuration[$key]; | |
72 } | |
73 } | |
74 | |
75 /** | |
76 * {@inheritdoc} | |
77 */ | |
78 public function set($key, $value) { | |
79 $this->configuration[$key] = $value; | |
80 } | |
81 | |
82 } |