public function Builder::getVariants in GridStack 8.2
Returns the available variants.
1 call to Builder::getVariants()
- Builder::getVariantLinks in src/
Plugin/ gridstack/ stylizer/ Builder.php - Returns the AJAX CRUD links for layout variants.
File
- src/
Plugin/ gridstack/ stylizer/ Builder.php, line 389
Class
- Builder
- Provides Layout Builder integration for editor previews.
Namespace
Drupal\gridstack\Plugin\gridstack\stylizerCode
public function getVariants($source, $reload = FALSE) {
if (!isset($this->variantOptions[$source]) || $reload) {
$options = [];
foreach ($this->manager
->entityLoadMultiple('gridstack_variant') as $key => $entity) {
if ($entity
->source() != $source) {
continue;
}
$options[$key] = Html::escape($entity
->label());
}
asort($options);
$this->variantOptions[$source] = $options;
}
return $this->variantOptions[$source];
}