You are here

public function Webform::updateWebformVariant in Webform 8.5

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

Update a webform variant for this webform.

Parameters

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

Return value

$this

Overrides WebformInterface::updateWebformVariant

File

src/Entity/Webform.php, line 2905

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function updateWebformVariant(WebformVariantInterface $variant) {
  $variant
    ->setWebform($this);
  $variant_id = $variant
    ->getVariantId();
  $configuration = $variant
    ->getConfiguration();
  $this
    ->getVariants()
    ->setInstanceConfiguration($variant_id, $configuration);
  $this
    ->save();
  return $this;
}