You are here

class BlockPageDisplayVariantSubscriber in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php \Drupal\block\EventSubscriber\BlockPageDisplayVariantSubscriber

Selects the block page display variant.

Hierarchy

Expanded class hierarchy of BlockPageDisplayVariantSubscriber

See also

\Drupal\block\Plugin\DisplayVariant\BlockPageVariant

1 string reference to 'BlockPageDisplayVariantSubscriber'
block.services.yml in core/modules/block/block.services.yml
core/modules/block/block.services.yml
1 service uses BlockPageDisplayVariantSubscriber
block.page_display_variant_subscriber in core/modules/block/block.services.yml
Drupal\block\EventSubscriber\BlockPageDisplayVariantSubscriber

File

core/modules/block/src/EventSubscriber/BlockPageDisplayVariantSubscriber.php, line 19
Contains \Drupal\block\EventSubscriber\BlockPageDisplayVariantSubscriber.

Namespace

Drupal\block\EventSubscriber
View source
class BlockPageDisplayVariantSubscriber implements EventSubscriberInterface {

  /**
   * Selects the block page display variant.
   *
   * @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event
   *   The event to process.
   */
  public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
    $event
      ->setPluginId('block_page');
  }

  /**
   * {@inheritdoc}
   */
  static function getSubscribedEvents() {
    $events[RenderEvents::SELECT_PAGE_DISPLAY_VARIANT][] = array(
      'onSelectPageDisplayVariant',
    );
    return $events;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockPageDisplayVariantSubscriber::getSubscribedEvents static function Returns an array of event names this subscriber wants to listen to. Overrides EventSubscriberInterface::getSubscribedEvents
BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant public function Selects the block page display variant.