BlockPlaceEventSubscriber::onBlockPageDisplayVariantSelected

public BlockPlaceEventSubscriber::onBlockPageDisplayVariantSelected(PageDisplayVariantSelectionEvent $event)

Selects the block place override of the block page display variant.

Parameters

\Drupal\Core\Render\PageDisplayVariantSelectionEvent $event: The event to process.

File

core/modules/block_place/src/EventSubscriber/BlockPlaceEventSubscriber.php, line 49

Class

BlockPlaceEventSubscriber

Namespace

Drupal\block_place\EventSubscriber

Code

public function onBlockPageDisplayVariantSelected(PageDisplayVariantSelectionEvent $event) {
  if ($event->getPluginId() === 'block_page') {
    if ($this->requestStack->getCurrentRequest()->query->has('block-place') && $this->account->hasPermission('administer blocks')) {
      $event->setPluginId('block_place_page');
    }
    $event->addCacheContexts(['user.permissions', 'url.query_args']);
  }
}
doc_Drupal
2016-10-29 08:47:47
Comments
Leave a Comment

Please login to continue.