function TipPluginBase::getLocation
Same name and namespace in other branches
- 9 core/modules/tour/src/TipPluginBase.php \Drupal\tour\TipPluginBase::getLocation()
- 11.x core/modules/tour/src/TipPluginBase.php \Drupal\tour\TipPluginBase::getLocation()
Returns the configured placement of the tip relative to the element.
If null, the tip will automatically determine the best position based on the element's position in the viewport.
This typically maps to the Shepherd Step options `attachTo.on` property.
Return value
string|null The tip placement relative to the element.
Overrides TipPluginInterface::getLocation
File
-
core/
modules/ tour/ src/ TipPluginBase.php, line 71
Class
- TipPluginBase
- Defines a base tour item implementation.
Namespace
Drupal\tourCode
public function getLocation() : ?string {
$location = $this->get('position');
// The location values accepted by PopperJS, the library used for
// positioning the tip.
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.