You are here

public function GridStackVariantSelectionForm::deleteVariant in GridStack 8.2

Callback for deleting a layout variant.

File

modules/gridstack_ui/src/Form/GridStackVariantSelectionForm.php, line 237

Class

GridStackVariantSelectionForm
Provides variant selection form.

Namespace

Drupal\gridstack_ui\Form

Code

public function deleteVariant(array &$form, FormStateInterface $form_state) {
  $vid = $form_state
    ->getValue('vid');
  if ($vid && ($variant = GridStackVariant::load($vid))) {
    $variant
      ->delete();
  }
  return $form;
}