You are here

public function TipPluginImage::getBody in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/tour/tests/tour_test/src/Plugin/tour/tip/TipPluginImage.php \Drupal\tour_test\Plugin\tour\tip\TipPluginImage::getBody()

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,
  ];
}