You are here

public function TipPluginImage::getBody in Drupal 9

Returns the body content of the tooltip.

This typically maps to the Shepherd Step options `text` property.

Return value

array A render array.

Overrides TourTipPluginInterface::getBody

See also

https://shepherdjs.dev/docs/Step.html

File

core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php, line 71

Class

TipPluginImage
Displays an image as a tip.

Namespace

Drupal\tour_test\Plugin\tour\tip

Code

public function getBody() : array {
  $image = [
    '#theme' => 'image',
    '#uri' => $this
      ->get('url'),
    '#alt' => $this
      ->get('alt'),
  ];
  return [
    '#type' => 'html_tag',
    '#tag' => 'p',
    '#attributes' => [
      'class' => [
        'tour-tip-image',
      ],
    ],
    'image' => $image,
  ];
}