public function Page::getVariant in Page Manager 8.4
Same name and namespace in other branches
- 8 src/Entity/Page.php \Drupal\page_manager\Entity\Page::getVariant()
Retrieves a specific variant.
Parameters
string $variant_id: The variant ID.
Return value
\Drupal\page_manager\PageVariantInterface The variant object.
Overrides PageInterface::getVariant
File
- src/
Entity/ Page.php, line 394
Class
- Page
- Defines a Page entity class.
Namespace
Drupal\page_manager\EntityCode
public function getVariant($variant_id) {
$variants = $this
->getVariants();
if (!isset($variants[$variant_id])) {
throw new \UnexpectedValueException('The requested variant does not exist or is not associated with this page');
}
return $variants[$variant_id];
}