You are here

public function GridStackVariant::createDuplicateVariant in GridStack 8.2

File

src/Entity/GridStackVariant.php, line 97

Class

GridStackVariant
Defines the GridStack variant configuration entity.

Namespace

Drupal\gridstack\Entity

Code

public function createDuplicateVariant($id, $label, array $options = []) {
  $duplicate = $this
    ->createDuplicate();
  $duplicate
    ->set('id', $id);
  $duplicate
    ->set('name', $id);
  $duplicate
    ->set('label', $label);
  $duplicate
    ->set('options', $options);
  return $duplicate;
}