public function Page::getVariants in Page Manager 8
Same name and namespace in other branches
- 8.4 src/Entity/Page.php \Drupal\page_manager\Entity\Page::getVariants()
Returns the variants available for the entity.
Return value
\Drupal\page_manager\PageVariantInterface[] An array of the variants.
Overrides PageInterface::getVariants
4 calls to Page::getVariants()
- Page::addVariant in src/
Entity/ Page.php - Adds a variant to this page.
- Page::getVariant in src/
Entity/ Page.php - Retrieves a specific variant.
- Page::removeParameter in src/
Entity/ Page.php - Removes a specific parameter context.
- Page::setParameter in src/
Entity/ Page.php - Adds/updates a given parameter context.
File
- src/
Entity/ Page.php, line 417 - Contains \Drupal\page_manager\Entity\Page.
Class
- Page
- Defines a Page entity class.
Namespace
Drupal\page_manager\EntityCode
public function getVariants() {
if (!isset($this->variants)) {
$this->variants = [];
/** @var \Drupal\page_manager\PageVariantInterface $variant */
foreach ($this
->variantStorage()
->loadByProperties([
'page' => $this
->id(),
]) as $variant) {
$this->variants[$variant
->id()] = $variant;
}
$this
->sortVariants();
}
return $this->variants;
}