function TestDisplayVariant::setContexts

Same name in other branches
  1. 8.9.x core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php \Drupal\display_variant_test\Plugin\DisplayVariant\TestDisplayVariant::setContexts()
  2. 10 core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php \Drupal\display_variant_test\Plugin\DisplayVariant\TestDisplayVariant::setContexts()
  3. 11.x core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php \Drupal\display_variant_test\Plugin\DisplayVariant\TestDisplayVariant::setContexts()

Sets the contexts.

Parameters

\Drupal\Component\Plugin\Context\ContextInterface[] $contexts: An array of contexts, keyed by context name.

Return value

$this

Overrides ContextAwareVariantInterface::setContexts

File

core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php, line 61

Class

TestDisplayVariant
Provides a display variant that requires configuration.

Namespace

Drupal\display_variant_test\Plugin\DisplayVariant

Code

public function setContexts(array $contexts) {
    $this->contexts = $contexts;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.