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);
  }
}
doc_Drupal
2016-10-29 08:57:17
Comments
Leave a Comment

Please login to continue.