Same filename and directory in other branches
- 8.9.x core/modules/tour/src/TipPluginBase.php
- 9 core/modules/tour/src/TipPluginBase.php
Namespace
Drupal\tour
File
core/modules/tour/src/TipPluginBase.php
View source
<?php
namespace Drupal\tour;
use Drupal\Core\Plugin\PluginBase;
abstract class TipPluginBase extends PluginBase implements TipPluginInterface {
protected $label;
protected $weight;
public function id() {
return $this
->get('id');
}
public function getLabel() {
return $this
->get('label');
}
public function getWeight() {
return $this
->get('weight');
}
public function get($key) {
if (!empty($this->configuration[$key])) {
return $this->configuration[$key];
}
}
public function set($key, $value) {
$this->configuration[$key] = $value;
}
public function getLocation() : ?string {
$location = $this
->get('position');
assert(in_array(trim($location ?? ''), [
'auto',
'auto-start',
'auto-end',
'top',
'top-start',
'top-end',
'bottom',
'bottom-start',
'bottom-end',
'right',
'right-start',
'right-end',
'left',
'left-start',
'left-end',
'',
], TRUE), "{$location} is not a valid Tour Tip position value");
return $location;
}
public function getSelector() : ?string {
return $this
->get('selector');
}
public function getBody() : array {
return [];
}
}
Classes