You are here

public function Webform::deleteState in Webform 8.5

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

Deletes an item from the webform's state.

Parameters

string $key: The item name to delete.

Overrides WebformInterface::deleteState

File

src/Entity/Webform.php, line 3119

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function deleteState($key) {
  $namespace = 'webform.webform.' . $this
    ->id();
  $values = \Drupal::state()
    ->get($namespace, []);
  unset($values[$key]);
  \Drupal::state()
    ->set($namespace, $values);
}