function ContentEntityForm::updateChangedTime

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::updateChangedTime()
  2. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::updateChangedTime()
  3. 11.x core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::updateChangedTime()

Updates the changed time of the entity.

Applies only if the entity implements the EntityChangedInterface.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity updated with the submitted values.

1 call to ContentEntityForm::updateChangedTime()
ContentEntityForm::submitForm in core/lib/Drupal/Core/Entity/ContentEntityForm.php

File

core/lib/Drupal/Core/Entity/ContentEntityForm.php, line 398

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

public function updateChangedTime(EntityInterface $entity) {
    if ($entity instanceof EntityChangedInterface) {
        $entity->setChangedTime($this->time
            ->getRequestTime());
    }
}

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