BlockPageDisplayVariantSubscriber.php in Drupal 9
File
core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php
View source
<?php
namespace Drupal\block\EventSubscriber;
use Drupal\Core\Render\PageDisplayVariantSelectionEvent;
use Drupal\Core\Render\RenderEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class BlockPageDisplayVariantSubscriber implements EventSubscriberInterface {
public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
$event
->setPluginId('block_page');
}
public static function getSubscribedEvents() {
$events[RenderEvents::SELECT_PAGE_DISPLAY_VARIANT][] = [
'onSelectPageDisplayVariant',
];
return $events;
}
}