You are here

public function BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant in Context groups 8

Same name and namespace in other branches
  1. 8.2 src/EventSubscriber/BlockPageDisplayVariantSubscriber.php \Drupal\context_groups\EventSubscriber\BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant()

Selects the context groups block page display variant.

Parameters

PageDisplayVariantSelectionEvent $event: The event to process.

File

src/EventSubscriber/BlockPageDisplayVariantSubscriber.php, line 49

Class

BlockPageDisplayVariantSubscriber
Class BlockPageDisplayVariantSubscriber.

Namespace

Drupal\context_groups\EventSubscriber

Code

public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {

  // Activate the context groups block page display variant.
  foreach ($this->contextManager
    ->getActiveReactions() as $reaction) {
    if ($reaction instanceof Blocks) {
      $event
        ->setPluginId('context_groups_block_page');
      break;
    }
  }
}