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