You are here

public function PageVariant::getPage in Page Manager 8.4

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

Gets the page this variant is on.

Return value

\Drupal\page_manager\PageInterface

Overrides PageVariantInterface::getPage

File

src/Entity/PageVariant.php, line 251

Class

PageVariant
Defines the page variant entity.

Namespace

Drupal\page_manager\Entity

Code

public function getPage() {
  if (!$this->pageEntity) {
    if (!$this->page) {
      throw new \UnexpectedValueException('The page variant has no associated page');
    }
    $this->pageEntity = $this
      ->getPageStorage()
      ->load($this->page);
    if (!$this->pageEntity) {
      throw new \UnexpectedValueException(sprintf('The page %s could not be loaded', $this->page));
    }
  }
  return $this->pageEntity;
}