public function Page::getVariant in Page Manager 8
Same name and namespace in other branches
- 8.4 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 397 - Contains \Drupal\page_manager\Entity\Page.
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];
}