You are here

public function YamlForm::deleteState in YAML Form 8

Deletes an item from the form's state.

Parameters

string $key: The item name to delete.

Overrides YamlFormInterface::deleteState

File

src/Entity/YamlForm.php, line 1472

Class

YamlForm
Defines the form entity.

Namespace

Drupal\yamlform\Entity

Code

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