You are here

public function YamlFormSubmission::getState in YAML Form 8

Track the state of a submission.

Return value

int Either STATE_NEW, STATE_DRAFT, STATE_COMPLETED, or STATE_UPDATED, depending on the last save operation performed.

Overrides YamlFormSubmissionInterface::getState

File

src/Entity/YamlFormSubmission.php, line 513

Class

YamlFormSubmission
Defines the YamlFormSubmission entity.

Namespace

Drupal\yamlform\Entity

Code

public function getState() {
  if (!$this
    ->id()) {
    return self::STATE_UNSAVED;
  }
  elseif ($this
    ->isDraft()) {
    return self::STATE_DRAFT;
  }
  elseif ($this->completed->value == $this->changed->value) {
    return self::STATE_COMPLETED;
  }
  else {
    return self::STATE_UPDATED;
  }
}