You are here

public function WebformSubmission::setElementData in Webform 8.5

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

Set a webform submission element's data.

Parameters

string $key: An webform submission element's key.

mixed $value: A value.

Return value

$this

Overrides WebformSubmissionInterface::setElementData

File

src/Entity/WebformSubmission.php, line 407

Class

WebformSubmission
Defines the WebformSubmission entity.

Namespace

Drupal\webform\Entity

Code

public function setElementData($key, $value) {

  // Make sure the element exists before setting its value.
  if ($this
    ->getWebform()
    ->getElement($key)) {
    $this->data[$key] = $value;
    $this->computedData = NULL;
    $this->dataHash = NULL;
  }
  return $this;
}