You are here

public function Webform::deleteWebformVariant in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Entity/Webform.php \Drupal\webform\Entity\Webform::deleteWebformVariant()

Deletes a webform variant from this webform.

Parameters

\Drupal\webform\Plugin\WebformVariantInterface $variant: The webform variant object.

Return value

$this

Overrides WebformInterface::deleteWebformVariant

1 call to Webform::deleteWebformVariant()
Webform::deleteElement in src/Entity/Webform.php
Remove an element.

File

src/Entity/Webform.php, line 2917

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function deleteWebformVariant(WebformVariantInterface $variant) {
  $variant
    ->setWebform($this);
  $this
    ->getVariants()
    ->removeInstanceId($variant
    ->getVariantId());
  $this
    ->save();
  return $this;
}