Displays some text as a tip.
@Tip("text");
Expanded class hierarchy of TipPluginText
class TipPluginText extends TipPluginBase {
/**
* The body text which is used for render of this Text Tip.
*
* @var string
*/
protected $body;
/**
* The forced position of where the tip will be located.
*
* @var string
*/
protected $location;
/**
* Returns a ID that is guaranteed uniqueness.
*
* @return string
* A unique id to be used to generate aria attributes.
*/
public function getAriaId() {
static $id;
if (!isset($id)) {
$id = drupal_html_id($this
->get('id'));
}
return $id;
}
/**
* Returns body of the text tip.
*
* @return string
* The tip body.
*/
public function getBody() {
return $this
->get('body');
}
/**
* Returns location of the text tip.
*
* @return string
* The tip location.
*/
public function getLocation() {
return $this
->get('location');
}
/**
* Overrides \Drupal\tour\TipPluginBase::getAttributes().
*/
public function getAttributes() {
$attributes = parent::getAttributes();
$attributes['data-aria-describedby'] = 'tour-tip-' . $this
->getAriaId() . '-contents';
$attributes['data-aria-labelledby'] = 'tour-tip-' . $this
->getAriaId() . '-label';
if ($location = $this
->get('location')) {
$attributes['data-options'] = 'tipLocation:' . $location;
}
return $attributes;
}
/**
* Implements \Drupal\tour\TipPluginInterface::getOutput().
*/
public function getOutput() {
$output = '<h2 class="tour-tip-label" id="tour-tip-' . $this
->getAriaId() . '-label">' . check_plain($this
->getLabel()) . '</h2>';
$output .= '<p class="tour-tip-body" id="tour-tip-' . $this
->getAriaId() . '-contents">' . filter_xss_admin($this
->getBody()) . '</p>';
return array(
'#markup' => $output,
);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
public | function |
Returns the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function |
Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Constructs a Drupal\Component\Plugin\PluginBase object. | 17 |
TipPluginBase:: |
protected | property | The attributes that will be applied to the markup of this tip. | |
TipPluginBase:: |
protected | property | The label which is used for render of this tip. | |
TipPluginBase:: |
protected | property | Allows tips to take more priority that others. | |
TipPluginBase:: |
public | function |
Implements \Drupal\tour\TipPluginInterface::get(). Overrides TipPluginInterface:: |
|
TipPluginBase:: |
public | function |
Implements \Drupal\tour\TipPluginInterface::getLabel(). Overrides TipPluginInterface:: |
|
TipPluginBase:: |
public | function |
Implements \Drupal\tour\TipPluginInterface::getWeight(). Overrides TipPluginInterface:: |
|
TipPluginBase:: |
public | function |
Implements \Drupal\tour\TipPluginInterface::set(). Overrides TipPluginInterface:: |
|
TipPluginText:: |
protected | property | The body text which is used for render of this Text Tip. | |
TipPluginText:: |
protected | property | The forced position of where the tip will be located. | |
TipPluginText:: |
public | function | Returns a ID that is guaranteed uniqueness. | |
TipPluginText:: |
public | function |
Overrides \Drupal\tour\TipPluginBase::getAttributes(). Overrides TipPluginBase:: |
|
TipPluginText:: |
public | function | Returns body of the text tip. | |
TipPluginText:: |
public | function | Returns location of the text tip. | |
TipPluginText:: |
public | function |
Implements \Drupal\tour\TipPluginInterface::getOutput(). Overrides TipPluginInterface:: |