public function Variant::override in GridStack 8.2
Allows layout variants to override the original optionset.
File
- src/
Plugin/ gridstack/ engine/ Variant.php, line 24
Class
- Variant
- Provides a shadow variant layout engine.
Namespace
Drupal\gridstack\Plugin\gridstack\engineCode
public function override(&$optionset, array &$settings) {
$variant = NULL;
if (isset($settings['vid']) && ($vid = $settings['vid'])) {
$variant = GridStackVariant::load($vid);
if ($variant && ($breakpoints = $variant
->getBreakpoints())) {
$optionset
->setOptions([
'breakpoints' => $breakpoints,
]);
$settings['_variant'] = $variant
->label();
}
}
return $variant;
}