You are here

public function PageVariant::getContexts in Page Manager 8

Same name and namespace in other branches
  1. 8.4 src/Entity/PageVariant.php \Drupal\page_manager\Entity\PageVariant::getContexts()

Gets the values for all defined contexts.

Return value

\Drupal\Core\Plugin\Context\ContextInterface[] An array of set context values, keyed by context name.

Overrides PageVariantInterface::getContexts

File

src/Entity/PageVariant.php, line 282
Contains Drupal\page_manager\Entity\PageVariant.

Class

PageVariant
Defines the page variant entity.

Namespace

Drupal\page_manager\Entity

Code

public function getContexts() {
  if (is_null($this->contexts)) {
    $static_contexts = $this
      ->getContextMapper()
      ->getContextValues($this
      ->getStaticContexts());
    $page_contexts = $this
      ->getPage()
      ->getContexts();
    $this->contexts = $page_contexts + $static_contexts;
  }
  return $this->contexts;
}