You are here

public function YamlForm::hasState in YAML Form 8

Determine if the stored value for a given key exists in the form's state.

Parameters

string $key: The key of the data to retrieve.

Return value

bool TRUE if the stored value for a given key exists

Overrides YamlFormInterface::hasState

File

src/Entity/YamlForm.php, line 1482

Class

YamlForm
Defines the form entity.

Namespace

Drupal\yamlform\Entity

Code

public function hasState($key) {
  $namespace = 'yamlform.yamlform.' . $this
    ->id();
  $values = \Drupal::state()
    ->get($namespace, []);
  return isset($values[$key]) ? TRUE : FALSE;
}