By bnjmnm on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
9.2.x
Introduced in version:
9.2.0
Issue links:
Description:
The getOutput() and getAttributes() methods of \Drupal\tour\TipPluginInterface are deprecated.
To update your plugin, you must implement \Drupal\tour\TourTipPluginInterface. The existing base class \Drupal\tour\TipPluginBase provides implementations for 2 of the 3 new methods. The 3rd new method getBody() is a replacement for getOutput():
Before:
public function getOutput() {
$output = '<h2 class="tour-tip-label" id="tour-tip-' . $this->getAriaId() . '-label">' . Html::escape($this->getLabel()) . '</h2>';
$output .= '<p class="tour-tip-body" id="tour-tip-' . $this->getAriaId() . '-contents">' . $this->token->replace($this->getBody()) . '</p>';
return ['#markup' => $output];
}
After:
public function getBody() {
// The label is now handled by calling code.
return [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => $this->token->replace($this->get('body')),
'#attributes' => [
'class' => ['tour-tip-body'],
],
];
}
Most plugins would not override getAttributes(), as the base implementation reads from the tour config.
In a similar way, the replacement method getSelector() also reads from tour config.
Before
attributes:
data-class: block-region-select
After
selector: '.block-region-select'
Impacts:
Site builders, administrators, editors
Module developers
Site templates, recipes and distribution developers