You are here

public function ContentEntityForm::updateChangedTime in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/ContentEntityForm.php \Drupal\Core\Entity\ContentEntityForm::updateChangedTime()
  2. 10 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
This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…

File

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

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());
  }
}