You are here

interface ContextAwareVariantInterface in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Display/ContextAwareVariantInterface.php \Drupal\Core\Display\ContextAwareVariantInterface
  2. 9 core/lib/Drupal/Core/Display/ContextAwareVariantInterface.php \Drupal\Core\Display\ContextAwareVariantInterface

Provides an interface for variant plugins that are context-aware.

Hierarchy

Expanded class hierarchy of ContextAwareVariantInterface

All classes that implement ContextAwareVariantInterface

2 files declare their use of ContextAwareVariantInterface
HtmlRenderer.php in core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php
TestDisplayVariant.php in core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php

File

core/lib/Drupal/Core/Display/ContextAwareVariantInterface.php, line 8

Namespace

Drupal\Core\Display
View source
interface ContextAwareVariantInterface extends VariantInterface {

  /**
   * Gets the values for all defined contexts.
   *
   * @return \Drupal\Component\Plugin\Context\ContextInterface[]
   *   An array of set contexts, keyed by context name.
   */
  public function getContexts();

  /**
   * Sets the context values for this display variant.
   *
   * @param \Drupal\Component\Plugin\Context\ContextInterface[] $contexts
   *   An array of contexts, keyed by context name.
   *
   * @return $this
   */
  public function setContexts(array $contexts);

}

Members