public function BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant in Context 8.0
Same name and namespace in other branches
- 8.4 src/EventSubscriber/BlockPageDisplayVariantSubscriber.php \Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant()
- 8 src/EventSubscriber/BlockPageDisplayVariantSubscriber.php \Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber::onSelectPageDisplayVariant()
Selects the context block page display variant.
Parameters
\Drupal\Core\Render\PageDisplayVariantSelectionEvent $event: The event to process.
File
- src/
EventSubscriber/ BlockPageDisplayVariantSubscriber.php, line 41 - Contains \Drupal\context\EventSubscriber\BlockPageDisplayVariantSubscriber.
Class
- BlockPageDisplayVariantSubscriber
- Selects the block page display variant.
Namespace
Drupal\context\EventSubscriberCode
public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
// Activate the context block page display variant if any of the reactions
// is a blocks reaction.
foreach ($this->contextManager
->getActiveReactions() as $reaction) {
if ($reaction instanceof Blocks) {
$event
->setPluginId('context_block_page');
break;
}
}
}