You are here

public function Webform::getVariantsData in Webform 6.x

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

Get variants data from a webform submission.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

array A associative array containing the variant element keys and variant value.

Overrides WebformInterface::getVariantsData

1 call to Webform::getVariantsData()
Webform::applyVariants in src/Entity/Webform.php
Apply webform variants based on a webform submission or parameter.

File

src/Entity/Webform.php, line 2970

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function getVariantsData(WebformSubmissionInterface $webform_submission) {
  $variants = [];
  $element_keys = $this
    ->getElementsVariant();
  foreach ($element_keys as $element_key) {
    $variants[$element_key] = $webform_submission
      ->getElementData($element_key);
  }
  return $variants;
}