You are here

public function Webform::updateWebformVariant in Webform 6.x

Same name and namespace in other branches
  1. 8.5 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 2906

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;
}