Mercurial > hg > isophonics-drupal-site
annotate core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\block\EventSubscriber; |
Chris@0 | 4 |
Chris@0 | 5 use Drupal\Core\Render\PageDisplayVariantSelectionEvent; |
Chris@0 | 6 use Drupal\Core\Render\RenderEvents; |
Chris@0 | 7 use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
Chris@0 | 8 |
Chris@0 | 9 /** |
Chris@0 | 10 * Selects the block page display variant. |
Chris@0 | 11 * |
Chris@0 | 12 * @see \Drupal\block\Plugin\DisplayVariant\BlockPageVariant |
Chris@0 | 13 */ |
Chris@0 | 14 class BlockPageDisplayVariantSubscriber implements EventSubscriberInterface { |
Chris@0 | 15 |
Chris@0 | 16 /** |
Chris@0 | 17 * Selects the block page display variant. |
Chris@0 | 18 * |
Chris@0 | 19 * @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event |
Chris@0 | 20 * The event to process. |
Chris@0 | 21 */ |
Chris@0 | 22 public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) { |
Chris@0 | 23 $event->setPluginId('block_page'); |
Chris@0 | 24 } |
Chris@0 | 25 |
Chris@0 | 26 /** |
Chris@0 | 27 * {@inheritdoc} |
Chris@0 | 28 */ |
Chris@0 | 29 public static function getSubscribedEvents() { |
Chris@0 | 30 $events[RenderEvents::SELECT_PAGE_DISPLAY_VARIANT][] = ['onSelectPageDisplayVariant']; |
Chris@0 | 31 return $events; |
Chris@0 | 32 } |
Chris@0 | 33 |
Chris@0 | 34 } |