function ContentEntityBase::updateOriginalValues

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::updateOriginalValues()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::updateOriginalValues()
  3. 10 core/lib/Drupal/Core/Entity/ContentEntityBase.php \Drupal\Core\Entity\ContentEntityBase::updateOriginalValues()

Updates the original values with the interim changes.

File

core/lib/Drupal/Core/Entity/ContentEntityBase.php, line 1056

Class

ContentEntityBase
Implements Entity Field API specific enhancements to the Entity class.

Namespace

Drupal\Core\Entity

Code

public function updateOriginalValues() {
    if (!$this->fields) {
        return;
    }
    foreach ($this->getFieldDefinitions() as $name => $definition) {
        if (!$definition->isComputed() && !empty($this->fields[$name])) {
            foreach ($this->fields[$name] as $langcode => $item) {
                $item->filterEmptyItems();
                $this->values[$name][$langcode] = $item->getValue();
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.