You are here

public function Webform::hasState in Webform 8.5

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

Determine if the stored value for a given key exists in the webform'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 WebformInterface::hasState

File

src/Entity/Webform.php, line 3129

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

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