public function YamlForm::setState in YAML Form 8
Saves a value for a given key in the form's state.
Parameters
string $key: The key of the data to store.
mixed $value: The data to store.
Overrides YamlFormInterface::setState
File
- src/
Entity/ YamlForm.php, line 1462
Class
- YamlForm
- Defines the form entity.
Namespace
Drupal\yamlform\EntityCode
public function setState($key, $value) {
$namespace = 'yamlform.yamlform.' . $this
->id();
$values = \Drupal::state()
->get($namespace, []);
$values[$key] = $value;
\Drupal::state()
->set($namespace, $values);
}