BlockWithImagePreview.php in Panopoly Magic 8.2
File
tests/modules/panopoly_magic_preview_test/src/Plugin/Block/BlockWithImagePreview.php
View source
<?php
namespace Drupal\panopoly_magic_preview_test\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\panopoly_magic\BlockPreviewInterface;
class BlockWithImagePreview extends BlockBase implements BlockPreviewInterface {
public function build() {
return [
'#markup' => $this
->t("BlockWithImagePreview: normal block content"),
];
}
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"),
];
}
}