You are here

public function TestPageDisplayVariantSubscriber::onSelectPageDisplayVariant in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/display_variant_test/src/EventSubscriber/TestPageDisplayVariantSubscriber.php \Drupal\display_variant_test\EventSubscriber\TestPageDisplayVariantSubscriber::onSelectPageDisplayVariant()

Selects the page display variant.

Parameters

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

File

core/modules/system/tests/modules/display_variant_test/src/EventSubscriber/TestPageDisplayVariantSubscriber.php, line 27
Contains \Drupal\display_variant_test\EventSubscriber\TestPageDisplayVariantSubscriber.

Class

TestPageDisplayVariantSubscriber
Selects the test page display variant.

Namespace

Drupal\display_variant_test\EventSubscriber

Code

public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
  $event
    ->setPluginId('display_variant_test');
  $event
    ->setPluginConfiguration([
    'required_configuration' => 'A very important, required value.',
  ]);
  $event
    ->addCacheTags([
    'custom_cache_tag',
  ]);
  $context = new Context(new ContextDefinition('string', NULL, TRUE), 'Explicitly passed in context.');
  $event
    ->setContexts([
    'context' => $context,
  ]);
}