public function ContentEntityForm::updateChangedTime

public ContentEntityForm::updateChangedTime(EntityInterface $entity)

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.

File

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

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

public function updateChangedTime(EntityInterface $entity) {
  if ($entity->getEntityType()->isSubclassOf(EntityChangedInterface::class)) {
    $entity->setChangedTime(REQUEST_TIME);
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityForm.php/function/ContentEntityForm::updateChangedTime/8.1.x