You are here

public function BlockWithImagePreview::buildPreview in Panopoly 8.2

Builds render array for block preview.

Like BlockPluginInterface::build() but for preview.

Return value

array Render array of block preview content.

Overrides BlockPreviewInterface::buildPreview

File

modules/panopoly/panopoly_magic/tests/modules/panopoly_magic_preview_test/src/Plugin/Block/BlockWithImagePreview.php, line 31

Class

BlockWithImagePreview
A block that uses an image preview.

Namespace

Drupal\panopoly_magic_preview_test\Plugin\Block

Code

public function buildPreview() {
  return [
    '#theme' => 'image',
    '#uri' => drupal_get_path('module', 'panopoly_magic_preview_test') . '/images/block-preview.png',
    '#alt' => $this
      ->t("BlockWithImagePreview: default preview image"),
  ];
}