/** * Retrieve the initial state value of the entity. * * @param \Drupal\rdf_entity\RdfInterface $entity * The solution entity. * * @return string * The machine name value of the state. * * @see https://www.drupal.org/node/2745673 */ protected function getState(RdfInterface $entity) { if ($entity->isNew()) { return $entity->field_is_state->first()->value; } else { $unchanged_entity = \Drupal::entityTypeManager()->getStorage('rdf_entity')->loadUnchanged($entity->id()); return $unchanged_entity->field_is_state->first()->value; } }